Select,radio form Echo Avoid using jquery to load assignments
Precautions :
Copy Code code as follows:
<body>
<form method= "POST" action= "" >
<!--It is not recommended to use the following code if the Reset feature is used in the form-->
<input type= "Radio" name= "Visible" value= "1"/> Show <br>
<input type= "Radio" name= "visible" value= "0"/> Hidden <br>
<select name= "by" id= "by" >
<option value= "0" >0</option>
<option value= "1" >1</option>
</select><br>
<input type= "Reset" >
</form>
</body>
Not recommended: Use the following JS code
Copy Code code as follows:
<script type= "Text/javascript" >
<!--
$ (function () {
Echo is not really the default value for data
$ ("input[type=radio][name=visible]"). each (function () {
if ($ (this). val () = = ' ${teacher.visible} ') {
$ (this). attr ("Checked", "checked");
}
});
$ ("#orderBy option"). each (function () {
if ($ (this). val () = = ' ${teacher.orderby} ') {
$ (this). attr ("Selected", "Selected");
}
});
});
-->
</script>
The best way to do this is to make logical judgments on JSP pages
Copy Code code as follows:
<!--recommended to use the following code-->
<input type= "Radio" name= "Visible" value= "1" <c:if test= "${teacher.visible==1}" >checked= "Checked" </c:if>/> show <br>
<input type= " Radio "name=" visible "value=" 0 "<c:if test=" ${teacher.visible==0} ">checked=" checked "</c:if>/> Hide < Br>