JQ写法和js写法 方法函数化

<script>
    $(function () { 
        $('#head').click=function () {
            alert($(this).html())
        }
    })  
</script>
<script>
    window.onload=function () {
    	 var Ohead=document.getElementById('head');
    	 Ohead.onclick=function () {
    	 	 alert(Ohead.innerHTML)
    	 }
    }
 </script>

 

<div id="head">111</div>

  

<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>

  

 jquery和js的不同写法 html()  innerHTML

alert( $(this).html() ); //jq的写法

alert( this.innerHTML ); //js的写法

原文地址:https://www.cnblogs.com/Xuman0927/p/5611163.html