unable to set property 'onclick' of undefined and img
please help me
THIS is my modal.js file code
-
- var modal = document.getElementById('myModal');
-
- var img = document.getElementById('<%= ImgProfile.ClientID %>');
- var modalImg = document.getElementById("img01");
-
- img.onclick = function () {
- alert("hello");
- modal.style.display = "block";
- modalImg.src = this.src;
-
- }
-
- var span = document.getElementsByClassName("close")[0];
-
-
- span.onclick = function() {
- modal.style.display = "none";
- }
THIS is my home.aspx file code
- <asp:Image ID="ImgProfile" runat="server" src="Images/19251082_10215259476544325_53831408_n.jpg" CssClass="img-thumbnail"/>
- <div id="myModal" class="modal">
- <span class="close">×</span>
- <img class="modal-content" id="img01" />
- <div id="caption"></div>
- </div>