求幫助help
<!DOCTYPE html>
<html>
? ? <head>
? ? ? ? <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
? ? ? ? <title>挑戰題</title>
? ? ? ? <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
? ? </head>
? ??
? ? <body>
? ? ? ? <li>1111</li>
? ? ? ? <li>2222</li>
? ? ? ? <li>3333</li>
? ? ? ? <li>44</li>
? ? ? ? <li>55</li>
? ? ? ? <li>66</li>
? ? ? ? <li>77</li>
? ? ? ? <a id="dianji" href="#">更多</a>
? ? ? ? <script>
? ? ? ? ? ? $("li:eq(4)").css("display","none")
? ? ? ? ? ? $("li:eq(5)").css("display","none")
? ? ? ? ? ? $("#dianji").click(function(){
? ? ? ? ? ? ? ? if($(this).text()==="更多"){
? ? ? ? ? ? ? ? ? ? $(this).text("簡化")
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else{
? ? ? ? ? ? ? ? ? ? $(this).text("更多")
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? })
? ? ? ? ? ? ? ??
? ? ? ? </script>
? ? </body>
</html>
里面的?if($(this).text()==="更多") 為啥不能換成?if($(this).text("更多"))
2016-06-04
if($(this).text()==="更多"是指?$(this).text()絕對等于字符更多
$(this).text("更多")是指把字符放入$(this).text()里面 類似于賦值
2016-06-15
第一個是哈希碼都一樣 第二個是直接賦值