The jQuery CSS effect is lost when render :action=>edit, how to get rid of it?
In my UI edit.html, I have
<input type='text', id='name'></input>
and I have
<p>Name:</p>
The, I have a javascript file which will use jQuery to css the style of the UI:
$('<p></p>').css('margin-left', '20px').insertAfter($('#name'));
The above CSS will locate <p>
element to be located 20px the right side of <input>
.
Everything is fine when my app firstly load the edit.html page, the CSS style is there.
BUT, when the model validation is failed, and in my controller, I use
render :action=>edit
,
the CSS style feature is lost;
however if my controller use
redirect_to :action=>edit, :id=>@user
,
the CSS style is there as expected.
Why my jquery defined CSS style is lost if I use render :action=>edit
to render this page. How to get rid of this? I would like to use render :action=>edit
w开发者_运维技巧hile keep my jQuery defined CSS taking effect.
精彩评论