By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,526 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

Run JQuery script in <option> value attribute when selected

P: 1
I've been ploughing through the archives here, but I can't seem to find a solution for my situation...

Essentially, I want to run the JQuery script that is in the "value" attribute of my <option> tags, when they are selected. I know to use onchange="" and probably 'this', but how do I get the string in the value tag to run as a function?

[HTML]<select name="Add Criteria" onchange="">
<option value="$('#associate').removeClass('hidden');">Ass ociate</option>
<option value="$('#company').removeClass('hidden');">Compa ny</option>

I feel like this should be simple, but I haven't been able to figure it out.

I would be very appreciative of any help anyone can give me.

Thank you very much!
Nov 6 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
Welcome to TSDN!

How about just using a string and passing this to a function which runs the JQuery script, e.g.[HTML]<select name="Add Criteria" onchange="runJQ(this.value);">
<option value="#associate">Associate</option>
<option value="#company">Company</option>

PS. changed the thread title to give it a better description.
Nov 7 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.