<l开发者_StackOverflow中文版i style="display: block;" class="selectlist-item">fsdafkds</li>
how can i disable a controller by class by jquery
If you want to hide it using jQuery:
$('.classname').hide();
The .
is the class-selector. Same as in CSS.
Your question isn't clear; you can't disable non-form field elements.
But if you want to select an element based on its class, here is how you can do that:
$('.selectlist-item')
Notice the dot
before class name. This is similar to CSS actually.
More Info:
- jQuery Class Selector
This is the code I use to disable or re-enable a control:
function handleControlDisplay(className, foundCount, checked) {
var button = jQuery(className);
if (foundCount > 0 && foundCount == checked) {
// enable
button.removeAttr("disabled");
}
else {
// set the disabled attribute
button.attr("disabled", "true");
};
}
精彩评论