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();
精彩评论