javascript - use selectors in variable jquery -
i have made functionality this on click of link show product details in popup box using big jquery code didn't understand
and here jsfiddle trying give links same class different #tags show div , want when click on link resolves href value of same , show corresponding result didnt works can suggest right way here js
$(".show").click(function() { var link = $('this').attr('href'); $(link).show(); });
and html
<a href="#popup" id="show" class="show">a</a> <a href="#popup1" id="show1" class="show">b</a> <a href="#popup2" id="show2" class="show">c</a>
i want show #popup on anchor click
full code on fiddle , want this functionality
you should call $(this)
, not $('this')
$(this)
wraps object referredthis
inside jquery object,$('this')
traverse of document looking html nodes taggedthis
(much$('div')
html nodes taggeddiv
); since there isn't any, select empty list of nodes.
working fiddle : http://jsfiddle.net/hg4zp/3/
( there typo, calling .hide(")
instead of .hide()
)
Comments
Post a Comment