this is external javascript file modal.js
when i used this code
var modal = document.getElementById("myModal")
var img = document.getElementById('<%= ImgProfile.ClientID %>');
img object null reference
please help me guys
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manav PandyaPosted Feb 3, 2018, 6:20 AM
Gaurav RajPosted Feb 3, 2018, 11:16 PM
var modal = document.getElementById("myModal");
// Get the image and insert it inside the modal - use its "alt" text as a caption
// var img = document.getElementById('<%= ImgProfile.ClientID %>');
// var imagesource = $("#ImgProfile").attr('src');
//alert(imagesource);
var modalImg = document.getElementById("img01");
//var captionText = document.getElementById("caption");
modal.style.display = "block";
modalImg.src="http://localhost:1041/Images/19251082_10215259476544325_53831408_n.jpg";
captionText.innerHTML = this.alt;
}