Hi guys
I have made an input with an image as background. When the input is active the input changes image.
I want it to animate/fade between theese states.
The way it works now: Class idleInput is added to the input onload. When input is active activeInput class is added instead. How can I animate this?
<script type="text/javascript">
$(document).ready(function() {
$('input[type="text"]').addClass("idleField");
$('input[type="text"]').focus(function() {
$(this).removeClass("idleField").addClass("focusField");
if (this.value == this.defaultValue){
this.value = '';
}
if(this.value != this.defaultValue){
this.select();
}
});
$('input[type="text"]').blur(function() {
$(this).removeClass("focusField").addClass("idleField");
if ($.trim(this.value) == ''){
this.value = (this.defaultValue ? this.defaultValue : '');
}
});
});
</script>
Thank you in advance, and sorry for my bad English... :-)