How to select an input by value with jQuery 1.4.3 and higher

后端 未结 5 1455
星月不相逢
星月不相逢 2020-12-10 00:49

With jQuery 1.4.2 and many previous version it is possible to select inputs like this:

$(\'input[value=test]\')

But with 1.4.3 and higher t

5条回答
  •  Happy的楠姐
    2020-12-10 01:24

    By this code you can select/make checked the input (type radio) by value, which is the same like "for" param in his label.

    jQuery('label').click(function() {
               labelID = jQuery(this).attr('for'); //find item and save "for" value
               jQuery('input[type=radio][value='+labelID+']').trigger('click') ; // find input with value and click
        });
    

提交回复
热议问题