如何为每个选中的复选框显示弹出窗口

时间:2016-04-28 12:18:47

标签: javascript jquery

我希望为每个选中的复选框显示一个弹出框。弹出框也会有一个复选框。因此,对于弹出框中选中的每个复选框,应将复选框的值推送到数组。

我做错了什么?

$('input[name="cases"]:checked').each(function() {
  cases.push($(this).attr('itemLabel'));
  console.log("cases",cases); 
  $("<div>Rule: "+$(this).attr('itemValue')+"<br><input type='checkbox' id='applyToall' name='applyToall'/><label>Apply to all?</label><br></div>").dialog();
  if($('input[name="applyToall"]:checked')) {
    ApplyToAll.push($(this).attr('itemLabel'));
    console.log("ApplyToAll",ApplyToAll)
  }
});

JSFIDDLE: https://jsfiddle.net/drxjhgeq/

0 个答案:

没有答案