关键词:
*
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
body
background-color: #fff;
margin: 30px;
h1
padding-bottom: 30px;
.container
max-width: 80%;
text-align: center;
margin: 0 auto;
.box
height: 150px;
width: 150px;
margin: auto;
border-radius: 10px;
background: green;
<!DOCTYPE html>
<html>
<head>
<title>jQuery Basics</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<div class="container">
<h1>Hello jQuery!</h1>
<div class="box"></div>
</div>
<script src="js/jquery-3.2.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>
// using plain js to hide the box
const box = document.querySelector('.box');
box.style.display = 'none';
//using jq to do same thing
jQuery('.box').hide();
$('.box').hide();
$('.box').show();
/////
//using js to add click event handler
const box = document.querySelector('.box');
box.addEventListener('click', function()
alert('You clicked me!');
);
//using jquery to make the same function
$('.box').click(function()
alert('You clicked me with jQuery');
);
javascriptjquery基础设置(代码片段)
查看详情
web前端开发工程师知识体系_33_javascriptjquery(代码片段)
一、添加/删除/替换/克隆1.添加新元素(1)DOM三步//a.创建新的空对象var元素=document.createElement("标签名")//b.添加必要属性元素.属性名=属性值//c.将新元素添加到DOM树//末尾追加新元素父元素.appendChild(新元素)//... 查看详情
web前端开发工程师知识体系_35_javascriptjquery(终)(代码片段)
一、Ajax$.ajax(url:"服务器端接口地址",type:"get或post",//请求类型data://如果没有参数,可省略参数名:参数值,...:...,dataType:"json",//自动调用JSON.parse()将服务器端返回的json字符串转化为内存中直接可用的数组或对... 查看详情
javascriptjquery片段(代码片段)
查看详情
javascriptjquery片段(代码片段)
查看详情
javascriptjquery的片段(代码片段)
查看详情
javascriptjquery的(代码片段)
查看详情
javascriptjquery过滤(代码片段)
查看详情
javascriptjquery的(代码片段)
查看详情
javascriptjquery-视差(代码片段)
查看详情
javascriptjquery插件(代码片段)
查看详情
javascriptjquery延迟(代码片段)
查看详情
javascriptjquery异步(代码片段)
查看详情
javascriptjquery菜单(代码片段)
查看详情
javascriptjquery验证(代码片段)
查看详情
javascriptjquery的(代码片段)
查看详情
javascriptjquery的(代码片段)
查看详情
javascriptjquery推迟(代码片段)
查看详情