views:

292

answers:

1

In Rails 3, I've got an update.js.erb template with one simple line of jquery:

$("#some_div").html("<strong>some_content</strong>");

Upon form submission, all the ajaxy stuff is working fine, but the content in #some_div is being replaced with "<strong>some_content</strong>" instead of some_content. Does anyone have a clue why?

This was working fine in Rails 2. Thanks in advance for the help.

Update (semi-solved):Stupid me, still had jquery.form plugin hanging around, which doesn't magically play well. Looks like I'll be ripping some stuff apart again ... thanks for the help, folks.

A: 

if you are on jQuery 1.4, please try,

$('#some_div').html(function(i,v){
    return $('<strong>').html('some_content');
});

( p.s. I like single quotes on javascript )

Reigel
Thanks Reigel ... I think my problem is due to some Rails 3 encoding /safe string magic that I don't get. Your code gave me an error: Syntax error, unrecognized expression: <strong>
@jonphillips - That's *definitely* rails encoding it, not a client-side issue...need to figure out why it's encoding the script.
Nick Craver
ahh okay nick.. I've never touch ruby yet..
Reigel