Seven price
asked on
jquery onclick detect id value
Hi, I am trying to for example alert a popup if and id has a value. so far the code does a popup with the id value and and blank popup if it has no value. I want to make sure there is not popup if there is no id value.
$(document).ready(function () {
$("a").click(function () {
if ($('a').val) {
alert(this.id);
}
else {
'nothing happen'
}
});
});
<a href="#" id="33" class="ui-link-inherit" >link1</a>
<a href="#" id="34" class="ui-link-inherit" >link2</a>
<a href="#" class="ui-link-inherit" >link no id1</a>
<a href="#" class="ui-link-inherit" >link no id2</a>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER