<div id="scriptparent"> <script type="text/javascript"> $( /* select above <div> from <script> ... without id and div property */ ) </script> </div>
from the code I have a <script>
block inside <div>
block. I'd like to select <div>
from <script>
without id, class, name selectors. How can I achieve this?
<div id="scriptparent"> <script type="text/javascript"> var scriptTag = document.scripts[document.scripts.length - 1]; var parentTag = scriptTag.parentNode; alert(parentTag.id); </script> </div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With