English 中文(简体)
关于在破箱中点击jquery采取行动的简单问题
原标题:Simple question regarding doing action on checkbox click in jquery

我必须研究10-15个这方面的辅导,但我不能这样做。

    jQuery( #sports : checkbox ).click(function() {

alert( it works );

}); 

页: 1 我有:

<input type="checkbox" name="sports"  />

它刚刚赢得笔工作,无论我试图做什么,我尝试过我可以做的每一种改动,投入检查箱在一张DIV或任何东西中都是没有的(但我也很想知道,如果它处于瘫痪状态的话,如何提及它。

   jQuery( #testdiv ).click(function() {

alert( it works );

}); 
最佳回答

没有空间:

jQuery( #sports:checkbox )

(# 选择含有相应识别符号的内容)

<input type="checkbox" name="sports"  id="sports" />

或请查询<代码> 姓名:

jQuery( input:checkbox[name=sports] )
问题回答

你们的遴选人不是旁边,而是需要这样做(就你目前的标志而言):

jQuery( :checkbox[name=sports] ).click(function() {
  alert( it works );
});

当您填写<代码>#sports: 核对箱 选择设计设计书,并不确定什么,但<代码>#sports :check Box<input category=“check Box”/>em>inside an content with id='sports”。 http://api.jquery.com/ category/selectors/“rel=“nofollow noreferer”>。

你们是否试图给你增加id? j Query中的编号指的是你选择补贴。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签