jquery

作者: 美琦miki视觉笔记 | 来源:发表于2020-01-15 12:00 被阅读0次

<!DOCTYPE html>

<html lang='en'>

<head>

    <meta charset="UTF-8">

    <title>Document</title>

    <script src="jquery-3.4.1.min.js"></script>

</head>

<body>

<h1 name="test"></h1>

<h1></h1>

<button>点我</button>

</body>

<script>

$(document).ready(function(){

$('h1[name="test"]').text('你好');

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

$('h1').text('我是h1');

$('h1[name="test"]').text('我是一个特别的h1');

/* Act on the event */

});

});

  </script> 

</html>


<!DOCTYPE html>

<html lang='en'>

<head>

    <meta charset="UTF-8">

    <title>Document</title>

    <script src="jquery-3.4.1.min.js"></script>

</head>

<style type="text/css">

h1:hover{

color:red;

}

</style>

<body>

<h1>我是h1</h1>

<h1>我是h1</h1>

</body>

<script>

$(document).ready(function(){

$('h1').hover(function() {

/* Stuff to do when the mouse enters the element */

$(this).text('进来了');

}, function() {

/* Stuff to do when the mouse leaves the element */

$(this).text('走了');

});

});

  </script> 

</html>


<!DOCTYPE html>

<html lang='en'>

<head>

    <meta charset="UTF-8">

    <title>Document</title>

    <script src="jquery-3.4.1.min.js"></script>

</head>

<style type="text/css">

h1:hover{

color:red;

}

</style>

<body>

<h1></h1>

<input type="text">

</body>

<script>

$(document).ready(function(){

$('input').keyup(function(event) {

/* Act on the event */

var content = $(this).val();

$('h1').text(content);

});

});

  </script> 

</html>

相关文章

网友评论

      本文标题:jquery

      本文链接:https://www.haomeiwen.com/subject/pkktzctx.html