Mr.A Mr.A - 1 year ago 350
jQuery Question

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

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 | */
!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

Answer Source

[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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download