Rails 3 jquery in js.erb template is creating escaped html?
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 hav开发者_如何学运维e 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.
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 )
精彩评论