So here it is by browsing my records each time I have to create a code with the ID how to make just one function for all the records?
$tbody .= '<script>
$(document).ready(function(){
$("#img'.$idImage .'").click(function () { $("#img'.$idImage.'").toggleClass("minresize") } );
});
</script>';
$tbody .= '<td><img id="img'.$idImage .'" src="'.ASSETDIRECTORY.'uploads/'.$value.'" alt="'.$value.'" title="'.$value.'"></td>';
CodePudding user response:
Actually this is working perfectly. Thank you Luc Laverdure your comments put me on the right track.
<img src="'.ASSETDIRECTORY.'uploads/'.$value.'" alt="'.$value.'" title="'.$value.'" onclick="$(this).toggleClass(\'maxresize\');" >
CodePudding user response:
something like this?
<img src="<?php echo ASSETDIRECTORY.'uploads/'.$value; ?>" alt="<?php echo $value; ?>" title="<?php echo $value; ?>" onclick="$(this).toggleClass('minresize');" />