jeudi 16 février 2017

Assigning ruby value to html element using jquery

I think this can be achieved easily but i am unable to know reason for not assigning a ruby variable to html element using jquery. My code looks like:

Example my ruby variable output is

@ruby_var = "1234"

I am assigning to html element using:

$("#html_element").html("<%= @ruby_var %>")

But the value is not assigning. If i use the following code every thing works fine:

var jvar = "1234"
$("#html_element").html(jvar)

Now value is assigned to html element. In my code i need to assign values to nearly 50 elements. Any help ...

Aucun commentaire:

Enregistrer un commentaire