Why can\'t I get this to work??
$(\"a\").each(function() { if ($(this[href$=\"?\"]).length()) { alert(\"Contains questionmark\"); } }); >
$(\"a\").each(function() { if ($(this[href$=\"?\"]).length()) { alert(\"Contains questionmark\"); } });
It doesn't work because it's syntactically nonsensical. You simply can't do that in JavaScript like that.
You can, however, use jQuery:
if ($(this).is('[href$=?]'))
You can also just look at the "href" value:
if (/\?$/.test(this.href))