jquery set radio selected prop according to value

<input name="rbsex" id="man_radio" type="radio" value="1" checked="checked" /><label>男</label> 

<input name="rbsex" id="woman_radio" type="radio" value="0" />女

var sex = result.resultContent.gender;

$(":radio[name='rbsex'][value='" + sex + "']").prop("checked", "checked");

Where prop is the key point, using attr does not work.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325331360&siteId=291194637