Get content from HTML element in Rails

Hey,
I’m looking for a way to get the content of my div in my Rails view. I
would like the literal HTML content, so only HTML and no Rails
I thought inner_html would work, but I get a RJS exception (TypeError:
$(“content”).innerHtml is not a function)

Does anyone know how I can get the content? Thanks!

In my controller I use this code:

def save_test
    render :update do |page|
        page['content'].innerHTML
    end
end

Some more context maybe? I get a HTML form (without the form tags
themselves) and put it into a rails form. What I want is that the user
changes checkboxes, radiobuttons, fills out input fields etc and when
the user saves, I want the literal changed content of the form as a
string to save it to my database.
The reason for this is that the several provided forms differ a lot and
it’s only used as information, no calculations etc need to be done on
it.
So my view looks like this:

form_remote_tag :url=>{:action => 'save_trainee_evaluation' do %>
<div id="content">
  <%= contract_trainer_trainee.evaluation_template %>
</div>
<%= submit_tag 'Opslaan' %>

<% end %>

Anybody?
If more info is needed, do ask!
Thanks

On 16 Mar 2010, at 16:44, Ignace S. wrote:

Anybody?
If more info is needed, do ask!
Thanks

More info is needed

Best regards

Peter De Berdt

innerHtml is not a function.

innerHTML is.

Larry

Peter De Berdt wrote:

On 16 Mar 2010, at 16:44, Ignace S. wrote:

Anybody?
If more info is needed, do ask!
Thanks

More info is needed

Best regards

Peter De Berdt

Little more specific? What exactly do you want to know?

Larry Meadors wrote:

innerHtml is not a function.

innerHTML is.

Larry

Yes, you’re right there, but as you can see, I use innerHTML in my
controller. And the same error message (but then with ‘innerHTML’) is
triggered.