Matt Elhotiby
Matt Elhotiby

Reputation: 44066

What is the fn in the snippet

I am looking at the jquery watermark plugin and i cant seem to understand whats going on... First off what does the fn mean and where is WatermarkColor being defined...ins not in this file

$.fn.Watermark = function(text,color) {
    if(!color)
        color="#2D2D2D";
    return this.each(
        function(){     
            var input=$(this);
            var defaultColor=input.css("color");
            map[map.length]={text:text,obj:input,DefaultColor:defaultColor,WatermarkColor:color};
            function clearMessage(){
                if(input.val()==text)
                    input.val("");
                input.css("color",defaultColor);
            }

Upvotes: 0

Views: 141

Answers (1)

Sean Vieira
Sean Vieira

Reputation: 159915

fn is a shortcut to prototype that jQuery sets up. WatermarkColor is whatever color is entered into the Watermark function, or it defaults to #2D2D2D.

Upvotes: 3

Related Questions