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相等;

 

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

__________________________________________________________________________________

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

相关文章:

  • 2021-07-12
  • 2021-10-06
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2021-08-17
猜你喜欢
  • 2021-12-24
  • 2022-01-10
  • 2021-08-03
  • 2021-09-06
  • 2021-10-24
  • 2022-12-23
相关资源
相似解决方案