开发者

jQuery disable checkbox style action

开发者 https://www.devze.com 2023-03-28 11:45 出处:网络
I want to disable an action that styles checkboxes and radiobuttons but i don\'t know how i can do this.

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

精彩评论

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