By default, Jquery selects the first single vertex radio and the single vertex and jqueryradio with the specified value.

Source: Internet
Author: User

By default, Jquery selects the first single vertex radio and the single vertex and jqueryradio with the specified value.
Overview when a page is loaded, the first option is selected for a single region in the specified region by default. When a user selects a single region and returns to the page again, you need to select the single-node JS selected last time and specify a radio with the id "admin-content-task"

// The value of the hidden field var platIdVal =$ ("# platIdVal "). val (); // if platIdVal is empty, it indicates that the single if (platIdVal = null | platIdVal = '') option is not checked '') {// the first $ (". admin-content-task input: first "). attr ("checked", true);} else {$ (". admin-content-task input [value = "+ platIdVal +"] "). attr ("checked", true );}
HTML page
<input type="hidden" id="platIdVal" value="${map.platIdVal?if_exists}"/>
<! -- Radio domain, some code --> <ul class = "am-list admin-content-task"> <# if apiInfos? Exists> <! -- N rows, using the chunk () function of FreeMarker --> <# list apiInfos? Chunk (7) as row> <div style = "clear: both; border: 0px solid green;"> <! -- Row number --> <div class = "platIdInnerDiv" style = "width: 1%;" >$ {row_index + 1}. </div> <! -- Div in the row, used to store the platId check box --> <# list row as obj> <div class = "platIdInnerDiv"> <input type = "radio" id = "platId $ {row_index }$ {obj_index} "name =" platId "value =" $ {obj. platId} "class =" platIdCls "/> <label for =" platId $ {row_index }$ {obj_index} ">$ {obj. platId} </label> </div> </# list> </# if> </ul>
Java
map.put("platIdVal", platId);
request.setAttribute("map", map);
UI
Original article, reprinted please indicate the source


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.