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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manav PandyaRank #166 · 14.3K reputationPosted Feb 3, 2018, 1:20 AM EST
Gaurav RajRank #2,919 · 493 reputationPosted Feb 3, 2018, 6:16 PM EST
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;
}