Answers for "compare image source in javascript"

7

how to change image source using javascript

document.getElementById("myImg").src = "hackanm.gif";
Posted by: Guest on February-08-2020
0

how to use text onclick to display images in javascript

$('img').click(function () { // on a click
  if($(this).attr('id') == '1') { // get the id attribute
    $('#div').html('Image with 1 was clicked'); // write the text
  } else { // else if
     // write something else for the 2
  }
}
Posted by: Guest on March-28-2020

Code answers related to "compare image source in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language