Getting ruby โ€‹โ€‹value in jquery

I have a text box in which I fill out a database record. I want to get the same value in textarea in jquery.

<textarea id="contact_address1"><%= @contact[:address1] %></textarea> 

How should I do it? Help me please!

-one
javascript jquery ruby ruby-on-rails
Jan 10 '14 at
source share
2 answers

What you are looking for is the jQuery val() function:

 $( "textarea#contact_address1").val(); 

Take a look: http://api.jquery.com/val/

+1
Jan 10 '14 at
source share

Try

 $("#contant_address1").text(); 

and make sure your textarea id should be "contant_address1".

0
Jan 10 '14 at
source share



All Articles