How can I change the value of a dropdown before submitting a form?
right now I have onclick event on the submit button that does:
alert(document.myform.myselect.value); //getting old value
document.rscGeneral.selectHlrId.value='x';
alert(document.myform.myselect.value);//getting null
The new value doesn't exist in options of the select...
I just need to modify the values being sent
Use this code - This might help
var yourValue
$("#myselect").find("option").attr("selected", "selected").val(yourValue);
CSS pseudo selector will do the trick.
var yourValue
$("#myselect").find("option:selected").val(yourValue);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.