abstrakt:<!DOCTYPE html><html><head> <title>jQuery操作屬性的方法</title> <script type="text/javascript" src="jquery-3.3.1.min.js"></script> <style type
<!DOCTYPE html>
<html>
<head>
<title>jQuery操作屬性的方法</title>
<script type="text/javascript" src="jquery-3.3.1.min.js"></script>
<style type="text/css">
.box{color: red;}
.main{font-size:40px;font-weight: bold;}
.bb{color: red;}
</style>
</head>
<body>
<script type="text/javascript">
$(document).ready(function () {
// $('p').addClass('box main');//多個(gè)class用空格分開(kāi)
// $('p').removeClass('box main');
// alert($('p').attr('title'));
// $('p').attr('title','你好');
// alert($('p').attr('title'));
// $('button').click(function () {
// $('img').removeAttr('src');
// })
// $('button').click(function () {
// alert($('div').hasClass('one'));
// })
// $('button').click(function () {
// $('span,b,p').toggleClass('bb')
// });
//alert($('b,span').text());
$('span').text('大家好,我是吳dddddddd');
//alert($('p').html());
$('p').html('<h1>新加一的H1標(biāo)簽</h1>');
//alert($('input').val());
$('input').val('我是被修復(fù)改的值');
})
</script>
<!-- <p title="content">PHP中文網(wǎng)</p>
<img src="jquery/images/1.jpg">
<button>點(diǎn)擊刪除圖片</button>
<div class="one">你好</div>
<button>點(diǎn)擊</button> -->
<span>大家好,我是老總</span><br>
<b>歡迎來(lái)到</b>
<p>php中文網(wǎng)</p>
<button>點(diǎn)擊切換</button>
<input type="text" name="" value="我是元素的值">
</body>
</html>