I currently have something like this:
$(".jtable tbody td").not(".DeleteLicense").hover(
How can I use delegate with this? Something like
$("#resultContainer,#approvalContainer,#createNewContain开发者_如何学Goer").delegate(".jtable tbody td....
Thanks!
You can use the :not()
selector to move the negation in to your selector.
$("#resultContainer,#approvalContainer,#createNewContainer")
.delegate(".jtable tbody td:not(.DeleteLicense)", "...", ...);
Note that the jQuery documentation recommends using the .not()
function rather than the :not()
selector in most cases, but I'm not sure if it is possible in this case.
If you're willing to use another approach, you may find that you could use the .jtable tbody td
selector in your call to delegate
, and then use if(!$(this).is(".DeleteLicense")) { ... }
in your event handler to only process elements that meet your criteria.
Like this:
$("#resultContainer,#approvalContainer,#createNewContainer").delegate(".jtable tbody td:not('.DeleteLicense')", "hover", function(eventObj) {
// handler code
});
My first thought would be to try and use the :not()
selector:
$("#resultContainer,#approvalContainer,#createNewContainer").delegate(".jtable tbody td:not('.DeleteLicense')", "hover", function(){ /* do stuff */});
精彩评论