开发者

jQuery disable checkbox style action

I want to disable an action that styles checkboxes and radiobuttons but i don't know how i can do this.

I have this Javascript line:

$("input[type=radio], input[type=checkbox]").customInp开发者_如何转开发ut();

This is working great, but when a checkbox is inside a table i want to disable that action.


try this, I have not attempted to run it but the idea is solid.

$("input[type=radio], input[type=checkbox]").each (function () 
{ 
if ($(this).parent("table").length == 0) 
{
customInput();
}
});


Use parents() instead of parent().

You could also try the filter function;

$("input[type=radio], input[type=checkbox]").filter(function(){ return $(this).parents("table").length }).customInput();​​​​​​​​​​​​​​​
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜