if statement - jquery - if href attr == "" -
i trying find out if href attr empty something, code follows...
jquery('#sidebar a').click(function() { var bob = jquery(this).attr("href"); if(jquery(bob).attr() == "") { alert('i empty href value'); } });
i not sure going wrong? advice? thanks!
you're passing bob
jquery
selector. test directly:
jquery('#sidebar a').click(function() { var bob = jquery(this).attr("href"); if (bob == "") { alert('i empty href value'); } });
or better yet, just:
if (!bob) {
Comments
Post a Comment