我有这样的 HTML:
<div class="icheckbox_flat-aero checked" style="position: relative;">
<input type="checkbox" class="icheck" id="Checkbox9" name="userAccessNeeded" target="Checkbox6" style="position: absolute; opacity: 0;">
<ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background-color: rgb(255, 255, 255); border: 0px; opacity: 0; background-position: initial initial; background-repeat: initial initial;"></ins>
</div>
这是我的 JavaScript:
$('.iCheck-helper').click(function () { // the element I clicked on
var parent = $(this).parent(); // gets the div element
var classNames = parent.find($("input")).prop("target"); // gets the input elements target
alert(classNames);
});
它应该可以工作,但它警告未定义。我究竟做错了什么?