Skip to main content

Change Image onClick Within DIV?



I have a jsFiddle setup to where you will be able to click on the image to the left and when you do it changes the image, but when you click on the DIV as an entirety (expand-one) it does not swap the image out.





I want to be able to click on a DIV (as a whole) and swap out an image that is within the DIV without having only being able to click on just the image.





You can view what I mean here: http://jsfiddle.net/5PDV5/1/





Thank you all! :)


Comments

Popular posts from this blog

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...