views:

35

answers:

1

I need to see if there is a current watermark set for an input field but i am not sure if there is a getter for this watermark plugin. I know i can set a watermark like this

 $("#request_money").Watermark("Not now");

I tried this but it doesnt seem to be setting the value

if($("#request_money").val() == "Not now"){
  $("#request_money").val("")
}

and i tried this

 $("#request_money").Watermark();

any ideas.....

+2  A: 

Based on your previous questions and your reasons for wanting to clear the value, I wan't to point out an alternative method that may appeal much more to you. Checkout other plugins like label over, you can try out a demo here.

Instead of ever actually putting a value in the field it just uses some CSS to position it over-top, giving the watermarked "effect"...but without anything to deal with when submitting the form.

There are other similar options out there, but this approach takes out the possibility of submitting the default value to the server, which is what you're after (again if you're reading just this...it's based on the OP's previous questions)...I think life would be much simpler if you went this route :)

Nick Craver
+1 for labelOver. it's so handy. and i agree it'll solve the problem
Patricia
awesome thanks......
Matt
@Matt - welcome, sorry this didn't occur to me the other day as a solution...I've used it in a few projects, it's very handy :)
Nick Craver