javascript - action when Value in a span -
i have simple code testing --- action little bit same want
---- sorry english --- hope understand me :-)
the html ---->
<div class="pagination"> <a href="#" class=""><span>1</span></a> <a href="#" class=""><span>2</span></a> </div> <div class="togglemenu">sdfsdfsdfsdf</div>
the jquery ----> when value in span 1 - hide tooglemenu .... doesn't work
$('.pagination').click(function () { if ($('.pagination span').html() == 2) { $(".togglemenu").hide(); } });
can me ? i'm new jquery-world :-)
first, want have click event handler on actual span clicking on, rather on entire pagination
block.
$('.pagination span').click(function() {
second, if
condition should testing current span clicked on , not first span
in html. using $(.pagination span).html()
checking first span
element 1
. within event handler function, this
variable points span
being clicked on.
if ($(this).html() == 2) {
Comments
Post a Comment