get the encapsulating script element

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
ell0bo
Forum Commoner
Posts: 79
Joined: Wed Aug 13, 2008 4:15 pm

get the encapsulating script element

Post by ell0bo »

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?
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: get the encapsulating script element

Post by kaszu »

You can't put <script> inside <select>, that's not valid. Add ID to the select and use it.
Post Reply