已采纳回答 / wwjjazz2
attr(a,b)中a为属性名,b为属性值,而css(c,d)中c为样式的属性名,d为样式中的属性值,如:<input type="password" style="border:1px solid red;">,a为"type",b为"password",c为"border",d为"1px solid red"。
2016-03-19
$(document).ready(function(){
$("#btntest").toggle(
function () {$("div").hide();},
function () {$("div").show();}
)
})
$("#btntest").toggle(
function () {$("div").hide();},
function () {$("div").show();}
)
})
2016-03-19
$('#btntest').click(function(){
$('#tip').html('我被点击了!');
})
$('#tip').html('我被点击了!');
})
2016-03-18
$(".red").wrapInner('<i>');
2016-03-18
$('body').append($('.red').clone());
var b = $('.red').clone();
alert(b.text());
var b = $('.red').clone();
alert(b.text());
2016-03-18
$(document).ready(function(){
var hide=$("li:hidden");
$("a").click(function(){
$("a").html()=="简化"?$("a").html("更多"):$("a").html("简化");
hide.css("display")=="block"?hide.css("display","none"):hide.css("display","block");
});
});
var hide=$("li:hidden");
$("a").click(function(){
$("a").html()=="简化"?$("a").html("更多"):$("a").html("简化");
hide.css("display")=="block"?hide.css("display","none"):hide.css("display","block");
});
});
<body>
<h3>使用clone()方法复制元素</h3>
<span class="red" title="hi">我是100RMB</span>
<script type="text/javascript">
$('body').append($('.red').clone())
</script>
</body>
<h3>使用clone()方法复制元素</h3>
<span class="red" title="hi">我是100RMB</span>
<script type="text/javascript">
$('body').append($('.red').clone())
</script>
</body>
2016-03-18
var newd = '<span class="red">,兄弟</span>';
$('.green').after(newd);
$('.green').after(newd);
2016-03-18
var exist = $('.green'),
$html = '<span class="red">土豪,<span/>';
exist.before($html);
$html = '<span class="red">土豪,<span/>';
exist.before($html);
2016-03-18
var ele = $('.red');
ele.appendTo('div');
ele.appendTo('div');
2016-03-18
$("#content").css({background:'red',color:"#fff"});
2016-03-18
$("#content").css({'background':'red','color':"#fff"});
2016-03-18