I want a simple js script to show a popup when a specific option from the dropdown is selected. The name of the selection tag is “ProfileType[0]”
It does not have a id attribute and it contains those special character. I tried to use jquery but no luck with it. And i would prefer if the selection tag code will be untouched means without adding any onchange event to it. And one more thing it already have a onchange event. I know its possible with jquery. You have any good code for this.
<select name="ProfileType[0]" onchange="window.location.href = "join.php?pid=" + this.value;">
<option value="1">Personal</option>
<option value="2">Professor</option>
<option value="4">Student</option>
</select>
Any help will be very much appreciate. Thanks
Using jQuery:
Demo: http://jsfiddle.net/YVNMK/
You don’t say which option is the specific one you care about, so I’ve gone with the first one.
Note that attaching the handler with jQuery should not affect the inline
onchange, though your existingonchangeis invalid because you’ve tried to use double-quotes inside other double-quotes – change one or other set of doubles to single-quotes: