This time I will show you how to solve the failure of radio dynamic control selection. What are the precautions to solve the failure of radio dynamic control selection? The following is a practical case, let’s take a look. take a look.
Gender selection Male and female Usually radio is used. When modifying customer information, the radio needs to be selected based on the information. The initial code method isconsole.log($(':radio[value='+data[2]+']').attr('checked'));
jQuery. Attr has been modified in different versions
**If your jQuery library version is below 1.6 , use the attr methodIf your jquery library version is 1.6 (including 1.6) or above, use the prop method**
$(':radio[value='+data[2]+']') .prop('checked',true);
Other related articles!
Recommended reading:How to implement the toggle method in jQuery
jQuery+JSONWhat is required for cross-domain P Realize
How to realize the jquery carriage return login effect
The above is the detailed content of How to solve the problem of radio dynamic control selection failure. For more information, please follow other related articles on the PHP Chinese website!