jQuery中 inArray

 

Js inArray 如何实现呢?

var product_type_id = data.product_type_id;

var pro_arr = product_type_id.split(',');

$('.bd_product_type').each(function (index) {

if ($.inArray($(this).val(), pro_arr) != -1) {

$(this).attr('checked', true);

}

});

 

多选自动选中:each 判断是否id相等;

 

文章来源:刘俊涛的博客 欢迎关注公众号、留言、评论,一起学习。

__________________________________________________________________________________

若有帮助到您,欢迎点击推荐,您的支持是对我坚持最好的肯定(*^_^*)

耶和华是我的牧者,我必不至缺乏。
原文地址:https://www.cnblogs.com/lovebing/p/14751788.html