asp.net - Passing javascript value to form fields fails with Internet Explorer (11) -


here piece of code (aspx/javascript) works fine in chrome , firefox, breaks in microsoft internet explorer. radio button scripting @ bottom takes values submitted when radio button selected via function @ top.

the variable "valuetext" takes contents of "value" property of radio button , passes 2 form fields.

why 'form1.anx_1.value' not return radio button value?

{...}         //called when radio button selected         function returnval(qid) {              $("#cmdsubmit").removeattr("disabled");             if (qid=='1') {var valuetext = form1.anx_1.value};             if (qid=='2') {var valuetext = form1.dep_1.value};             if (qid=='3') {var valuetext = form1.anx_2.value};             if (qid=='4') {var valuetext = form1.dep_2.value};             if (qid=='5') {var valuetext = form1.anx_3.value};             if (qid=='6') {var valuetext = form1.dep_3.value};             if (qid=='7') {var valuetext = form1.anx_4.value};             if (qid=='8') {var valuetext = form1.dep_4.value};             if (qid=='9') {var valuetext = form1.anx_5.value};             if (qid=='10') {var valuetext = form1.dep_5.value};             if (qid=='11') {var valuetext = form1.anx_6.value};             if (qid=='12') {var valuetext = form1.dep_6.value};             if (qid=='13') {var valuetext = form1.anx_7.value};             if (qid=='14') {var valuetext = form1.dep_7.value};              // --- here breaks ----             $("#values").val(valuetext);             $("#itemscore").val(valuetext);             // --- both above values not passed ---              document.getelementbyid("enter_button").src = "images/green_button.png"         }     </script>  <input type="hidden" name = "itemscore" id="itemscore" value="" /> <table align="center" style="width:1000px; border-spacing: 60px; right: auto; left: auto; background-color: #cccccc;"> <tr>  <%if qid = "1" then%> <td style="width:180px;"><h2 style="font-family: arial; text-align: center;"> feel happy life in general:</h2><br /> <div id="anx_1" style="font-size: <%=fontsize%>px"> <input type="radio" id="anx_1_1" name="anx_1" value= "3" onclick="returnval(<%=qid%>)" /> <label for="anx_1_1">mostly</label> <input type="radio" id="anx_1_2" name="anx_1" value= "2" onclick="returnval(<%=qid%>)" /> <label for="anx_1_2">quite bit</label> <input type="radio" id="anx_1_3" name="anx_1" value= "1" onclick="returnval(<%=qid%>)" /> <label for="anx_1_3">only bit</label> <input type="radio" id="anx_1_4" name="anx_1" value= "0" onclick="returnval(<%=qid%>)" /> <label for="anx_1_4">not @ all</label> </div>  </td> <%end if%>  {other form elements , 'submit' button...} 

this piece $("#cmdsubmit").removeattr("disabled"); not crossbrowser safe, can use $("#cmdsubmit").prop("disabled", false); hope help

p.s ah , better set "disabled" $("#cmdsubmit").prop("disabled", true); this!


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -