返回jquery基......登陆

jquery基础语法

辰晨2019-07-21 15:11:46279

基本语法:

1.引入jquery文件

2.将语句写到jquery函数内

【1】完整模式

$(document).ready(function(){

jquery语句;

jquery语句;

})

【2】简写模式

$(function(){

jquery语句;

jquery语句;

});


案例:

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>jquery基础语法</title>

<script

  src="https://code.jquery.com/jquery-3.4.1.js"

  ></script>

</head>

<body>

<script>

$(document).ready(function(){

$('div').css('background','red');

$('div').css('width','100px');

$('div').css('height','100px');

})

</script>

<div></div>

</body>

</html>


最新手记推荐

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

全部回复(0)我要回复

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