Ric*_*ard 0 jquery jquery-mobile
看到这个小提琴:http://jsfiddle.net/Bg9Zx/5/
相关代码:
<fieldset data-role="controlgroup" data-type="horizontal" id="locate-me">
<input type="checkbox" name="loc" id="loc" />
<label for="loc">Locate me</label>
</fieldset>
$("#loc").click(function(){
alert('locate clicked!');
});
Run Code Online (Sandbox Code Playgroud)
为什么.click()事件不会被触发?如果我不引用jQuery Mobile,那么工作得很好.
谢谢!
你错了.#loc是指使用此元素的ID.
<label class="test" for="loc">Locate me</label>
$(".test").click(function(){
alert('locate clicked!');
});
Run Code Online (Sandbox Code Playgroud)