jQuery日本語リファレンス

jQuery does not mean Japanese Query...

Internals/API/jQuery - Sample Code

jQuery.removeData(elem)


            
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="/jquery/js/jquery.js"></script>
  
  <script>
  $(document).ready(function(){
    
    var adiv = $("div").get(0);

    $("span:eq(0)").text("" + jQuery.data(adiv, "test1"));
    jQuery.data(adiv, "test1", "VALUE-1");
    jQuery.data(adiv, "test2", "VALUE-2");
    $("span:eq(1)").text("" + jQuery.data(adiv, "test1"));
    jQuery.removeData(adiv);
    $("span:eq(2)").text("" + jQuery.data(adiv, "test1"));
    $("span:eq(3)").text("" + jQuery.data(adiv, "test2"));

  });
  </script>
  <style>
  div { margin:2px; color:blue; }
  span { color:red; }
  </style>
</head>
<body>
  <div>value1 データ設定前: <span></span></div>
  <div>value1 データ設定後: <span></span></div>
  <div>value1 データ削除後: <span></span></div>
  <div>value2 データ削除後: <span></span></div>
</body>
</html>
            
          
[実行結果]
[jQuery.removeData(elem) の説明へ]