I am looking at the following sample logon form:
Notice that there is a 'Remember' sprite at the bottom. Essentially, there is a hidden check-box below a 2-state image. When the image is clicked, it changes to either a green check or slides to a red 'x'. When viewing the DOM state of the check-box, the value does not change (defaults to value="1"). If I were to use this, what JQuery would I use to detect the state change of the image so that I can change the value of the check-box?
Here is the form HTML:
<div id="logonForm">
<div id="box">
<div class="elements">
<div class="avatar"></div>
<form action="" method="post">
<input type="text" id="un" name="username" class="username" placeholder="Username" />
<input type="password" id="pw" name="password" class="password" placeholder="•••••••••" />
<div class="checkbox">
<!-- here is the CHECK-BOX that I need to change value with JQuery -->
<input id="check" name="checkbox" type="checkbox" value="1" />
<label for="check">Remember?</label>
</div>
<div class="remember">Remember?</div>
<input type="button" id="login" name="submit" class="submit" value="Sign In" />
</form>
</div>
</div>
Here is the css for the form check-box and label (provided by the author):
.checkbox {
display: block;
width: 40px;
height: 15px;
overflow: hidden;
border-radius: 5px;
float:left;
margin:5px 0 0 0;5
}
input[type=checkbox] {
display: none;
}
input[type=checkbox] + label {
text-indent: -9999px;
display: block;
width: 40px;
height: 15px;
line-height: 15px;
background: transparent url(../images/checkboxfield.png) no-repeat;
-webkit-transition: background-position 0.3s ease-in-out;
-moz-transition: background-position 0.3s ease-in-out;
}
input[type=checkbox]:checked + label {
-webkit-transition: background-position 0.3s ease-in-out;
-moz-transition: background-position 0.3s ease-in-out;
background-position:-26px;
}