开发者

JQUERY BIND to a LABEL, and pass the name & value Take 2

Given the following HTML:

    <p id="noteTypebox">
    <label for="noteType_1" class="notetypelabel active" id="noteType_1">
    <input type="radio" name="noteTypeID" value="1" checked="checked" class="notetype">Project Meeting</input>
    </label>
<label for="noteType_2" cl开发者_如何学Goass="notetypelabel" id="noteType_2">
<input type="radio" name="noteTypeID" value="2" class="notetype">IDI</input>
</label>

    </p>

How can I write JQUERY to bind to the LABEL, so that on click it alerts first the LABEL's ID and then the INPUT's value (1)?

Thanks


//

$('label').click(function(){
  alert(this.id);
  alert($(this).find('input').val());
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜