Domanda

I need to set the value of a field in my form using rjs.

That field in question appears twice in my form and I want to set the value of the field found inside a particular div only.

The code below does not seem to work.

page[:mydiv_id][:book_bk_title].value = "myvalue"

My question is how do i set the value of a field by also specifying the div containing it. using rjs?

È stato utile?

Soluzione

If you are using Jquery:

var div_id = "mydiv";
$("#"+div_id+" :input[ID^='input_id']").val('Field Value');
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top