返回jQuery操......登陆

jQuery操作属性测试

Love Never Dies.I Never Repent2019-01-02 19:27:35335

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Document</title>

<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>

<style type="text/css">

.box{

width: 200px;

background: red;

}

</style>

<script type="text/javascript">

$(document).ready(function(){

$('div').toggleClass('box');

$('p').attr('.box');

$('button').click(function(){

$('p').removeAttr('box');

$('p').html('内容被修改了');

$('span').html('<h1>span被替换</h1>');

})


})


</script>


</head>

<body>

<div>我是DIV</div>

<p>P元素</p>

<span>行内元素</span>

<button>点击</button>

</div>

</body>

</html>


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送