hello …
I basically have a load of code using jQuery, that I now realise I have to add an if statement to every on(‘mouseenter’) event I have depending on whether or not a boolean is true or false.
Ok - easy. But I wish to build a jQuery plugin (at the most simplest level), so that my query will continue and chain - or break. Is there a jQuery method that already exists that does that?
Otherwise::
var myBreak = true;
jQuery.fn.makeOrBreak = function(v){
// break chain or query
if(v != true){
}else{
// keep calm and carry on
}
};
// usage example
$('#id').makeOrBreak(myBreak).hide(); // boolean is true so '#id' is allowed to chain and 'hide()'
maybe there’s easier ways - but it’s interesting to build a plugin. And I have around 40 mouse overs ive got to plug an if statement into …
Any pointers!?
PS am i in the right forum?!