javascript - How to change clickable image in HTML table row dynamically? -
i have 2 records on html table. in last column of each row have image clickable. upon click, calling javascript function.
what need know if image can changed once clicked? changed image should not clickable , should not trigger javascript function.
please give me solution in jquery or javascript.
just change src
attribute of image clicked change image, using attr()
you can reference clicked img
using $(this)
in event handler.
to ensure new image not clickable anymore, use one()
bind event handler.
$('img').one('click', function(){ alert('clicked'); $(this).attr('src', 'http://placehold.it/50x50'); });
Comments
Post a Comment