How do I make this plugin return false and still chain <p>I have written a plugin which isn't finished yet I might add. All it does at the moment is to check if all inputs are empty. If any inputs are empty it puts a message under the input.</p> <p>Now the plugin is suppose to return false if it fails.</p> <p>The problem is chaining. The way it works at the moment it doesn't chain if I return false, because I am not returning base.</p> <p>How do I make this plugin return false and still chain.</p> <pre><code>;(function($){ "use strict"; $.fn.valiDate = function(options){ var base=this; /*Adds the input on the page */ if(!$('#asi_validate').length) { $('.footer').before('&lt;span style="border:1px solid black;background-color:#FFF;color:red;\ box-shadow: 5px 5px 5px #888888;padding:5px;position:absolute;width:auto;display:none;\ " id="asi_validate"&gt;&lt;/span&gt;'); } var valid = true; var validatepos=$('#asi_validate'); base.check_key= function(){ $(this).keyup(function(){ validatepos.fadeOut(50); }); } base.check= function() { $('input').each(function() { if (this.value == '') { var cell=$(this); var position = cell.offset(),maxLength=cell.val().length; validatepos.css('left',position.left), validatepos.css('top',position.top+(cell.outerHeight()+2)), validatepos.fadeIn(100), validatepos.html('This field is required'); valid = false; return false; } }); } base.check_key(); base.check(); if (valid === false) { return false; } return base; }; })(jQuery); </code></pre>