How to check a radio button with jQuery?

前端 未结 30 2093
独厮守ぢ
独厮守ぢ 2020-11-22 08:12

I try to check a radio button with jQuery. Here\'s my code:

30条回答
  •  醉话见心
    2020-11-22 09:11

    If property name does not work don't forget that id still exists. This answer is for people who wants to target the id here how you do.

    $('input[id=element_id][value=element_value]').prop("checked",true);
    

    Because property name does not work for me. Make sure you don't surround id and name with double/single quotations.

    Cheers!

提交回复
热议问题