n. ???, ??? ???, ?? ???? ??? ?;
jquery jQuery.removeData() ?? ???
??: removeData() ???? ??? data() ???? ??? ???? ?????. ??? ?? ??? ?????. .removeData()? ???? ?? ? ?????.
??: ??$(selector).removeData(??)
????:
???? | Description |
name | ?? ?????. ??? ???? ??? ?????. ??? ???? ?? ?? ? ???? ??? ???? ??? ?? ???? ?????. |
jquery jQuery.removeData() ?? ?
<html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#btn1").click(function(){ $("div").data("greeting", "Hello World"); alert("Greeting is: " + $("div").data("greeting")); }); $("#btn2").click(function(){ $("div").removeData("greeting"); alert("Greeting is: " + $("div").data("greeting")); }); }); </script> </head> <body> <button id="btn1">向 div 元素添加數(shù)據(jù)</button><br /> <button id="btn2">從 div 元素刪除數(shù)據(jù)</button> <div></div> </body> </html>
??? ????? ??? "???? ??" ??? ?????