Topic: visual effects with javascript insert/replace?

Hi,

I'm seeking to modify Ryan Bates's (Railscast) code for dynamic forms, such that an element fades/blinds/etc. in the view. I can't seem to involve the familiar effects code in Ryan's javascript, however.

Here is the code I'd like to inject visual effects into:

 
function add_fields(link, association, content) {
  var new_id = new Date().getTime();
  var regexp = new RegExp("new_" + association, "g")
  $(link).up().insert({
    before: content.replace(regexp, new_id)
  });
}

Can anyone show me how effects are to be injected into this, e.g., the inserted element fades into view?

Thanks,

Grar

Re: visual effects with javascript insert/replace?

should do it...

content.fadeOut().replace(regexp, new_id).fadeIn()

If not try

content.fadeOut(function(){$(this).replace(regexp, new_id).fadeIn()})

Re: visual effects with javascript insert/replace?

Thanks for your reply. Neither work, but I'm getting 'element null' errors from firebug, so content may not be in the form the visual effects require.

grary