javascript - Hide Image when another image is clicked -


this seems simple.. bit noobish jquery, maybe doing silly wrong?

i want click image, , on click, hide image right next it.

 <script type="text/javascript">            $("#butshowmesomeunits").click(function() {              $('#arrowunitspic').hide();         });    </script> 

id's correct per 2 images. missing? debugging it, code never gets fired...

thanks

edit

i had control nested control on asp masterpage, , id being rewritten. have fixed id, still cant joy... see markup being rendered "input", make difference?

<head> <script src="js/jquery.min.1.5.js" type="text/javascript"></script>      <script type="text/javascript">         $(document).ready(function () {             $("#butshowmesomeunits").click(function () {                 $('#arrowunitspic').hide();             });         });  </script> </head>  <body> <input type="image" src="bookings_media/buttons/show-me-some-units.png" onmouseout="this.src='bookings_media/buttons/show-me-some-units.png'" onmouseover="this.src='bookings_media/buttons/show-me-some-units_orange.png'" id="butshowmesomeunits" name="ctl00$ctl00$contentplaceholder1$bookings_right_content$butshowmesomeunits"> </body> 

edit js fiddle

if there confusion... js fiddle spooled exact code not work...

you need do on page ready:

<script type="text/javascript">  $(document).ready(function() {        $("#butshowmesomeunits").click(function() {              $('#arrowunitspic').hide();         }); }); </script> 

edit: fiddle provided did not work until chose jquery 1.10.1 dropdown. notice onmouseover changes element first, once click on input hide image. can verify works same you?

if answer no don't think loading jquery library on page. check should work:

if (typeof jquery != 'undefined') {      alert("jquery library loaded!");  }else{      alert("jquery library not found!");  } 

in addition might helpful see errors browser console /dev tools showing.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -