Этот вопрос похож на мой предыдущий вопрос (converting css hover to jquery hover), но ответ будет другим, потому что он включает функцию щелчка и два bgs.JQuery Fade Effect On Form Input Focus
Я создаю контактную страницу, и когда пользователь нажимает на одно из полей ввода, я хочу, чтобы фон ввода исчезал от одного bg к другому. Вы можете увидеть здесь: Contact Page
В настоящее время я добавил этот код, чтобы сделать большинство из входов выцветают на щелчок, но текстовое поле не будет работать:
<script type="text/javascript">
if(window.jQuery){jQuery(function(){
(function(){ jQuery('input.name').bind('focus', function(event, ui){var target = jQuery('input.name'); target.animate({'backgroundColor':'#b1b1b1'},250,'linear')});})();
(function(){ jQuery('input.name').bind('blur', function(event, ui){var target = jQuery('input.name'); target.animate({'backgroundColor':'#CFD2D2'},250,'linear')});})();
(function(){ jQuery('input.email').bind('focus', function(event, ui){var target = jQuery('input.email'); target.animate({'backgroundColor':'#b1b1b1'},250,'linear')});})();
(function(){ jQuery('input.email').bind('blur', function(event, ui){var target = jQuery('input.email'); target.animate({'backgroundColor':'#CFD2D2'},250,'linear')});})();
(function(){ jQuery('input.website').bind('focus', function(event, ui){var target = jQuery('input.website'); target.animate({'backgroundColor':'#b1b1b1'},250,'linear')});})();
(function(){ jQuery('input.website').bind('blur', function(event, ui){var target = jQuery('input.website'); target.animate({'backgroundColor':'#CFD2D2'},250,'linear')});})();
(function(){ jQuery('input.area').bind('focus', function(event, ui){var target = jQuery('input.area'); target.animate({'backgroundColor':'#b1b1b1'},250,'linear')});})();
(function(){ jQuery('input.area').bind('blur', function(event, ui){var target = jQuery('input.area'); target.animate({'backgroundColor':'#CFD2D2'},250,'linear')});})();
})};
</script>
Любые идеи о том, как сделать это правильно, и сделать работу textarea?