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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -