Is there a way to get an object or it's id within a script lies using jQuery or something?
For example:
<div id="div1">
<script type="text/javascript">
var obj = ?? // this should be the "div1" div
</script>
</div>
In this example, obj should be equal to "div1" (or the object itself).
Another one:
<p id="paragraph_7">
<script type="text/javascript">
var obj = ?? // this should be the "paragraph_7" p
</script>
</p>
In this example, obj should be equal to "paragraph_7" (or the object itself).
If I give an "id" to the script tag and then get it's parent should work, but is there another way? not always i'm able to know the <script>
id.
Thanks in advance.