Support » Plugin: WPaudio MP3 Player » Does not work with latest jQuery (Solution provided)

  • Resolved mrienstra

    (@mrienstra)


    I get this error:

    Uncaught Syntax error, unrecognized expression: [href$=.mp3]

    “cybacolt” has already shown that this can be fixed by changing the JS from:

    jQuery('a[href$=.mp3]').addClass('wpaudio');

    To:

    jQuery('a[href$=mp3]').addClass('wpaudio');

    However, the real issue here is that “.mp3” is supposed to be quoted, according to http://api.jquery.com/attribute-ends-with-selector/ (“Quotes are mandatory”).

    But there’s a second, more subtle issue: “The comparison is case sensitive.” — this means a link ending in “.MP3” will be ignored. So here’s a more comprehensive fix:

    jQuery("a").filter(function(){ return /\.mp3$/i.test($(this).attr("href")); })

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Does not work with latest jQuery (Solution provided)’ is closed to new replies.