skip to Main Content

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 .'" class="minresize" src="'.ASSETDIRECTORY.'uploads/'.$value.'" alt="'.$value.'" title="'.$value.'"></td>';

2

Answers


  1. Chosen as BEST ANSWER

    Actually this is working perfectly. Thank you Luc Laverdure your comments put me on the right track.

    <img class="minresize" src="'.ASSETDIRECTORY.'uploads/'.$value.'" alt="'.$value.'" title="'.$value.'" onclick="$(this).toggleClass('maxresize');" >
    

  2. something like this?

    <img src="<?php echo ASSETDIRECTORY.'uploads/'.$value; ?>" alt="<?php echo $value; ?>" title="<?php echo $value; ?>" onclick="$(this).toggleClass('minresize');" class="minresize" />
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search