$("div").unbind("click").unbind("dblclick");
2015-05-07
应该这样写,小编留的空太坑人了。。。
$(function(){
$("#btntest").toggle(function(){
$("div").hide();
},
function(){
$("div").show()
})
});
$(function(){
$("#btntest").toggle(function(){
$("div").hide();
},
function(){
$("div").show()
})
});
2015-05-07
$("li:last-child").css("background-color", "blue");
':last'只匹配一个元素,而此选择符将为每个父元素匹配一个子元素
':last'只匹配一个元素,而此选择符将为每个父元素匹配一个子元素
2015-05-07
<script type="text/javascript">
$("li:first-child").css("background-color", "green");
</script>
:first-child子获取的是父辈元素的首个子元素
$("li:first-child").css("background-color", "green");
</script>
:first-child子获取的是父辈元素的首个子元素
2015-05-07
<script type="text/javascript">
$("li[title*='果']").css("background-color", "green");
</script>
$("li[title*='果']").css("background-color", "green");
</script>
2015-05-07
<script type="text/javascript">
$("li[title!='蔬菜']").css("background-color", "green");
</script>
$("li[title!='蔬菜']").css("background-color", "green");
</script>
2015-05-07
<script type="text/javascript">
$("li[title='蔬菜']").css("background-color", "green");
</script>
[attribute=value]属性选择器
$("li[title='蔬菜']").css("background-color", "green");
</script>
[attribute=value]属性选择器
2015-05-07
<script type="text/javascript">
$("li:visible").css("background-color","blue");
</script>
$("li:visible").css("background-color","blue");
</script>
2015-05-07
<script type="text/javascript">
var $strHTML = $("#hidstr").val();
$("div").html($strHTML);
</script>
<script type="text/javascript">
var $strHTML = $("input:hidden").val();
$("div").html($strHTML);
var $strHTML = $("#hidstr").val();
$("div").html($strHTML);
</script>
<script type="text/javascript">
var $strHTML = $("input:hidden").val();
$("div").html($strHTML);
2015-05-07
<script type="text/javascript">
$("li:has('label')").css("background-color", "blue");
</script>
$("li:has('label')").css("background-color", "blue");
</script>
2015-05-07
<script type="text/javascript">
$("li:contains('jQuery')").css("background", "green");
</script>
$("li:contains('jQuery')").css("background", "green");
</script>
2015-05-07