Відмінності між версіями «Підказки для форми»

Матеріал з Wiki Welard
Перейти до навігації Перейти до пошуку
 
Рядок 1: Рядок 1:
−
Можна зробити за допомогою [JQuery]
+
Можна зробити за допомогою JQuery
  
 
  jQuery(document).ready(function(){
 
  jQuery(document).ready(function(){

Поточна версія на 07:17, 2 липня 2010

Можна зробити за допомогою JQuery

jQuery(document).ready(function(){
  $("input, textarea").focus(function(){
    if ($(this).attr("value") == $(this).attr("title"))
      $(this).attr("value", "")
  });
  $("input, textarea").blur(function(){
    if ($(this).attr("value") == "")
      $(this).attr("value", $(this).attr("title"))
  });
});