function blur focus en jquery sur les valeurs des champs d un formulaire


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function traitement_input_may(form) {
  2.  
  3. $('input,textarea',form).each(function(index) {
  4. var input=$(this);
  5.  
  6. input.attr('title',input.attr('value'));
  7.  
  8.  
  9. input.blur(function() {
  10. if (input.attr('value')=='') input.attr('value',input.attr('title'))
  11. })
  12.  
  13. input.focus(function() {
  14. if (input.attr('value')==input.attr('title')) input.attr('value','')
  15. })
  16.  
  17. });
  18.  
  19. }
  20.  
  21. jQuery().ready(function(){
  22.  
  23. traitement_input_may($('#formContact'))
  24.  
  25. })

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.