get the encapsulating script element
Posted: Mon Oct 25, 2010 12:48 pm
So say that I want to get the script tag that is responsible for housing a current function, does anyone know how to do that? Let me put this into context so it makes a little more sense.
<select>Options here</select>
<script>
Some code that wants to mess with that select
</script>
If I can get that code inside of the select to know the node that contains it, I can then to .parent().find(‘select’).whatever inline before the element is rendered, this reducing the ‘flickering’ of transforming that select into a jSelect. I would also be able to do it fast enough so that using an inline script doesn’t make me hate myself.
So… does anyone know how to get the encapsulating script element of a current JS block?
<select>Options here</select>
<script>
Some code that wants to mess with that select
</script>
If I can get that code inside of the select to know the node that contains it, I can then to .parent().find(‘select’).whatever inline before the element is rendered, this reducing the ‘flickering’ of transforming that select into a jSelect. I would also be able to do it fast enough so that using an inline script doesn’t make me hate myself.
So… does anyone know how to get the encapsulating script element of a current JS block?