In short, I am loading a local HTML page in divinside another web form in asp.net.
JQuery:
<script>
$(function () {
$("#includedContent").load("../HtmlHolder/index.html");
});
</script>
HTML:
<div id="includedContent" class="WebHolder" style="width: 450px; height: 300px; border: 1px solid #808080; margin: 0px auto; overflow-y: scroll;"></div>
Now I want to get the class name of the element by clicking on it below the script:
<script>
$(document).ready(function () {
$('.WebHolder').on("click", "*", function (e) {
alert("Class :" + $(this).attr("class"));
});
});
</script>
My problem is that when I click on any element, this code warns this class name and its parent!
How to solve it?
Note: the item is not a specific object, it may be an input or button or text area or ....
source
share