anilkumar Posted June 2, 2006 Share Posted June 2, 2006 Hello all, I had the problem ussing <select> in html with default value.<select name="cars" onChange="gcr_sbmit();"><option selected="selected" value=""></option><option value="volvo">Volvo</option><option value="saab">Saab</option><option value="fiat">Fiat</option><option value="audi">Audi</option></select>I want to raise the event when the user does the selection, but the actual problem raises when the user selects the selected option with "" as value.I dont want to raise event for it, how can i get tht be done( i.e. i dont want to execute the gcr_submit function for tht selected value)Thanks,Regards,Anil. Link to comment Share on other sites More sharing options...
pulpfiction Posted June 2, 2006 Share Posted June 2, 2006 In that event check for value = ""like this....if not value="" thendo somthing Link to comment Share on other sites More sharing options...
zachary Posted June 3, 2006 Share Posted June 3, 2006 You could see if this helps:<html><head><script type="text/javascript">function comingsoon(){document.write("Comming soon<br />")}</script></head><body><select size="5"><option onclick="comingsoon()" disabled>test<option onclick="comingsoon()" disabled>test2</select></body></html> Link to comment Share on other sites More sharing options...
Jack McKalling Posted June 3, 2006 Share Posted June 3, 2006 (edited) <select name="cars" onChange="if (this.value) gcr_sbmit();"><option selected="selected">Select an option:</option><option value="volvo">Volvo</option><option value="saab">Saab</option><option value="fiat">Fiat</option><option value="audi">Audi</option></select>Like this, there is no value for the selected (default) option. The function will only be called for options that do have a value Edited June 3, 2006 by Dan The Prof Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now