Pregunta

I have made this simple function that add placeholders to browsers that do not support them by default, like Explorer 8.

DEMO

The question is: How can i make a plugin with that function? In order to remove the code from the html file and put it in a separate js file?

Thank you!

¿Fue útil?

Solución

Just so you know: there is already a plugin for that.

JQuery UI has a nice learning center.

Basic example from learning center above:

(function ( $ ) {

    var shade = "#556b2f";

    $.fn.placeholder = function() {
        // your code
        return this;
    };

}( jQuery ));
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top