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
javascript jquery ruby-on-rails


source to share


No one has answered this question yet

See similar questions:

4
Rails - firing javascript events from controllers

or similar:

7428
How can I check if an element is hidden in jQuery?
4523
Thinking in AngularJS if I have a jQuery background?
4345
How to check if a checkbox is checked in jQuery?
3952
Setting "checked" for a checkbox with jQuery?
2644
Is there a function "exists" for jQuery?
2414
How can I find out which radio button is selected using jQuery?
2302
Add table row in jQuery
2245
How do I refresh the page using jQuery?
2101
jQuery scroll to element
1957
Disable / enable input with jQuery?



All Articles
Loading...
X
Show
Funny
Dev
Pics