GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Sunday, January 30, 2011

Extending jQuery

It's simple to extends jQuery:

<script src="jquery.js"></script>
<div id="satu">Before Extended</div>

<script>

(function($){
    $.fn.myPlugin = function(){
        this.html('<h1>After Extended</h1>');
        this.css('color','blue');
    };
});

$('#satu').myPlugin();

</script>

Output:
After Extended
   
Share/Bookmark

No comments:

Post a Comment