이봐, 내가 체크하면 체크 박스의 ID를 얻는 방법을 궁금해.체크 박스의 ID를 가져 옵니까? - jQuery
<div class="check_filter">
<div id="filter">
<input type="checkbox" id="check1" /><label for="check1">Marketing</label>
<input type="checkbox" id="check2" /><label for="check2">Automotive</label>
<input type="checkbox" id="check3" /><label for="check3">Sports</label>
</div>
</div><!-- End check_filter -->
을 내가 jQuery를 이런 식으로 뭔가 보일 것 있으리라 믿고있어 :
$(document).ready(function() {
$(":checkbox").click(function(){
var id = $(this).attr('id');
$.post("index.php", { id: id });
//return false to ensure the page doesn't refresh
return false;
});
});
내가 체크 얻으려고을
이 내 HTML은 아마 처음과 같을 것이다 것입니다 item id를 입력하고 그 id를 mysql 쿼리에 게시하여 데이터베이스에서 id 결과를 가져온다.
감사합니다.
나는'check' 이벤트 대신'change' 이벤트를 사용할 것입니다. 그렇지 않으면 코드가 제대로 작동하는 것처럼 보입니다. 당신은 그것을 시도하고 그것을 발견하지 못했습니까? –