最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - (jQuery.js error) uncaught Error: Syntax error, unrecognized expression: [href=#] - Stack Overflow

programmeradmin8浏览0评论

I am having trouble with a WP plugin. Users cannot upload an avatar or background, as well as view their profile from the profile section. Once the button is pushed to perform profile related actions they are redirected to the home page. Here is a bit of the code (functions receiving errors) and pictures of the console log errors errors.

some console log errors are because there are no pictures. I have deliberately removed profile and background photos. This problem happens with or without images.

/*! jQuery v1.12.4 | (c) jQuery Foundation | jquery/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0)
function(a){if(!a.document){throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,
function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=
function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:

I have performed the following Troubleshooting task:

  1. uninstalled and reinstalled the plugin.
  2. Adjusted all settings for redirects.
  3. Checked Themes (not the theme).
  4. Deleted everything and started from scratch.
  5. Deactivated all other plugins (plugins not the problem).

This is the Console log error for users attempting to change their background or avatar

The 2nd picture is of the console log error when an individual tries to view their profile

I am having trouble with a WP plugin. Users cannot upload an avatar or background, as well as view their profile from the profile section. Once the button is pushed to perform profile related actions they are redirected to the home page. Here is a bit of the code (functions receiving errors) and pictures of the console log errors errors.

some console log errors are because there are no pictures. I have deliberately removed profile and background photos. This problem happens with or without images.

/*! jQuery v1.12.4 | (c) jQuery Foundation | jquery/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0)
function(a){if(!a.document){throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,
function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=
function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:

I have performed the following Troubleshooting task:

  1. uninstalled and reinstalled the plugin.
  2. Adjusted all settings for redirects.
  3. Checked Themes (not the theme).
  4. Deleted everything and started from scratch.
  5. Deactivated all other plugins (plugins not the problem).

This is the Console log error for users attempting to change their background or avatar

The 2nd picture is of the console log error when an individual tries to view their profile

Share Improve this question asked Sep 5, 2016 at 19:54 ReshResh 231 gold badge1 silver badge5 bronze badges 1
  • As a general rule, if you get an error thrown at you from the middle of jQuery, it's because you passed it something invalid. You should try using the "Pause on unhandled exceptions" features of Developer Tools, and check the call stack to see what led to the error. – Niet the Dark Absol Commented Sep 5, 2016 at 20:40
Add a ment  | 

1 Answer 1

Reset to default 3

[href=#] is not a valid CSS selector.

In an attribute selector (the [name=value] syntax), the value MUST be surrounded by quotes UNLESS the value is a valid CSS identifier: starts with a letter, contains only letters, numbers, hyphens and underscores (in this case, quotes are optional)

Since # quite clearly fails the "valid CSS identifier", it must be quoted.

[href='#'] will work just fine.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论