1.
$ ("[Type=checkbox]"). attr ("Checked", true); Online query is because the new version of jquery attr replaced with prop, according to this method changed, all OK.
2.
Do not know if you have encountered, not with struts2 development, natural can not use the STRUTS2 tag library.
If there is a need, go through 34 provinces and cities nationwide, and tick the provinces you have been to. So the effect is as follows:
If the provinces and cities are list<provinces> provinceslist, then uploading to the JSP page, we should certainly choose to use JSTL tags <c:forEach> traversal.
1 <C:foreachItems= "${provinceslist}"var= "Provinces">2 <inputtype= "checkbox"name= "PIDs"value= "${provinces.pid}"/>${provinces.name}3 </C:foreach>
If user Zhang San has been to Guangdong province and Jilin Province as above, then how to echo?
This is the time to use two <c:forEach> nesting:
1 <C:foreachItems= "${provinceslist}"var= "Provinces">2 <inputtype= "checkbox"name= "PIDs"value= "${provinces.pid}"3 <c:foreach Items= "${zsprovinces}"var= "Province">4 <c:ifTest= "${province.pid = = provinces.pid}">5 checked= "Checked"6 </c:if>7 </C:foreach>8 />${provinces.name}9 </C:foreach>
This whole me for a few hours, ashamed!!!
CheckBox and <c:forEach> problem record in development