jquery: How to set a few onmouse listeners
<p>Not sure what i am doing wrong but  <code>alert(titleTxt)</code>; shows always  <code>other_location</code>. I need add two <code>onmouse</code> listeners but seems it is always attached to the last element.     </p>

<pre><code>function ghostText(name){
    obj = $("input[name='"+name+"']");
    titleTxt = obj.val();
    obj.css('color', '#cccccc');
    obj.mouseover(function() {
        if(obj.val() == titleTxt){
            obj.val(""); 
            obj.css('color', '#333333');
        }
        alert(titleTxt);
    });
    obj.mouseout(function() {
        if(obj.val() == ''){
            obj.val(titleTxt); 
            obj.css('color', '#cccccc');
        }
    });
}

ghostText('keyword');
ghostText('other_location');
</code></pre>
