Executing jQuery script on rendering

I would like to execute a jQuery script while rendering an activity in my rails controller.

To be more precise, I have this function in my User Controller ...

def create
    @user = User.new(user_params)
    if @user.save
      # Successful save
    else
      render action: "new", layout: "signup"
    end
end

      

... and I want to add a class to a specific element in my file new.html.erb

. I only need to do this when rendering because I don't want the class to be pre- added .

How can i do this?

+3


source to share





All Articles