javascript - How to override jQuery global functions for my plugin? -


i have created plugin creates check box image based based on hidden field. override is() function... possible? i'm using image mock checkbox.

html:

<input type="hidden" value="1" id="box" /> 

create plugin hidden field:

$('#box').mycheckbox(); 

i able following:

$('#box').is(':checked'); 

is possible override is() function in plugin?

yep :)

           (function() {               var proxied = jquery.fn.is;               jquery.fn.is= function() {                 //do things here                 return proxied.apply(this, arguments);//call default here               };             })(); 

btw :checked supported default

so if u had

$('#checkbox').is(':checked');// return true/false depending if checkbox ticked or not don't on complicate things pull ur hair out later on when u forgot u made overriding changes :)


Comments

Popular posts from this blog

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

jQuery clickable div with working mailto link inside -