<div> <ul><li title="hidden" style="display:none">1</li>
<li title="hidden" style="display:none">2</li>
<li title="display">3</li><li title="display">4</li><li title="display">5</li><li title="display">6</li><li title="display">7</li><li><a href="#">更多</a></li></ul></div>
<li title="hidden" style="display:none">2</li>
<li title="display">3</li><li title="display">4</li><li title="display">5</li><li title="display">6</li><li title="display">7</li><li><a href="#">更多</a></li></ul></div>
$(document).ready(function(){$("a").click(function(){
if($("a").html()=="更多"){
$("a").html("简化"); $("li[title='hidden']").show();
}else{
$("a").html("更多"); $("li[title='hidden']").hide();
} })})
if($("a").html()=="更多"){
$("a").html("简化"); $("li[title='hidden']").show();
}else{
$("a").html("更多"); $("li[title='hidden']").hide();
} })})
$("div label").css("background-color","blue");
2016-06-16
$(".red,.green").html("hi,我们的样子很美哦!");
2016-06-16
$(".red,.blue").html("hi,我们的样子很美哦!");
2016-06-16
<script type="text/javascript">
var jsons = [{"name":"wwwo","age":"12"},{"name":"gdao1","age":"122"},{"name":"g2o2","age":"132"}]
$(function () {
$.each(jsons, function (index, data) {
$("#divtest").append("<li>"+data.name+"--"+data.age+"</li>");});});
</script>
var jsons = [{"name":"wwwo","age":"12"},{"name":"gdao1","age":"122"},{"name":"g2o2","age":"132"}]
$(function () {
$.each(jsons, function (index, data) {
$("#divtest").append("<li>"+data.name+"--"+data.age+"</li>");});});
</script>
最赞回答 / 妹妹大胆往前走
自答了:#divtest .content .tip{ border: solid 1px #ccc; background-color: #eee; margin: 10px 0px; padding: 8px; display: none;}display设置为none,默认是不显示的,所以要显示strTmp,必须先$('tip').show(),让其显示。然后再赋值.html(strTmp)
2016-06-15
<script type="text/javascript">
$(function () {
$("#btntest").bind("click", function () {
$("div").toggle();
})
});
</script>
$(function () {
$("#btntest").bind("click", function () {
$("div").toggle();
})
});
</script>
2016-06-15