当只有用户选择该特定复选框时,如何显示jquery复选框列表的选定项目以及标签

Made to Order(assembled) HP/Compaq IBM Lenovo etc
Made to Order(assembled) Compaq IBM etc
HP/Compaq IBM Lenovo Sony Dell etc

小提琴

 $("select[name='qwe'] option").click(function () { $(this).each(function () { var label = $(this).parent().parent().parent().find('label').text(); var text = $(this).text(); alert('option text is ' + text); alert('label text is ' + label); }); }) 

UPDATE

正如@mplungjan建议FIDDLE

 $("select[name='qwe']").change(function () { $(this).each(function () { var text1 = $(this).find('option:selected').text(); var label1 = $(this).find('option:selected').parent().parent().parent().find('label').text(); alert('option text is ' + text1); alert('label text is ' + label1); }); 

UPDATE

没有.parent().closest('div.classnameoftheparentdiv')

小提琴

 $("select[name='qwe']").change(function () { $(this).each(function () { var text1 = $(this).find('option:selected').text(); var label1 = $(this).find('option:selected').closest('div.form_field').find('label').text();//HERE parent div that contains the label has a class form_field alert('option text is ' + text1); alert('label text is ' + label1); }); })