Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

changing margin value using jQuery

I have below code if there is error msg. then the margin top of login form should be "0" and for the first error msg margin top should be "70px".

<span class="portlet-msg-error"> You have entered invalid data. Please try again. </span>

<span class="portlet-msg-error"> Authentication failed. Please try again.</span>

<div class="login-form" style="margin-top: 70px;"> Form Display here </div>
like image 905
Ritesh Patel Avatar asked Jan 06 '11 06:01

Ritesh Patel


1 Answers

$('.login-form').css({'margin-top':'0px'}); // Login form
$('.portlet-msg-error:first').css({'margin-top':'70px'}); // Error Message

It may be marginTop, I forget if jQuery can accept the full name or if you have to camelCase it when there are hyphens

EDIT Just checked, margin-top seems to work

like image 138
Brad Christie Avatar answered Oct 20 '22 17:10

Brad Christie