各位码友 注意:
Jq改为
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.js"></script>
就可以了
Jq改为
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.js"></script>
就可以了
2016-11-25
src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"
2016-11-24
/*选择器其他一些例子*/
语法 描述
$('input[name="user"]') 获取name值为user的input标签
$('input[name$="user"]') 获取name值为user结尾的input标签
$("ul li:first") 每个 <ul> 的第一个 <li> 元素
$("ul li:eq(0)") 每个 <ul> 下标为0的<li>元素
$("[href$='.jpg']") 所有带有以 ".jpg" 结尾的属性值的 href 属性
语法 描述
$('input[name="user"]') 获取name值为user的input标签
$('input[name$="user"]') 获取name值为user结尾的input标签
$("ul li:first") 每个 <ul> 的第一个 <li> 元素
$("ul li:eq(0)") 每个 <ul> 下标为0的<li>元素
$("[href$='.jpg']") 所有带有以 ".jpg" 结尾的属性值的 href 属性
2016-11-24
Query实现:nth-child(n)是严格来自CSS规范,所以n值是“索引”,也就是说,从1开始计数,:nth-child(index)从1开始的,而eq(index)是从0开始的
2016-11-24
$('p').click(function(){
//把p元素转化成jQuery的对象
var $this= $(this)
$this.css('color','red')
})
//把p元素转化成jQuery的对象
var $this= $(this)
$this.css('color','red')
})
2016-11-24
报错 Uncaught ReferenceError: $div is not defined
2016-11-22