点击切换帐号登陆
帐号密码登陆

jQuery设置\获取元素内容

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>jquery第九节课</title>
	<script type="text/javascript" src="jquery-3.3.1.min.js"></script>
  <script type="text/javascript">
   $(function(){
    //jQuery获取\设置内容
    //text()设置或返回所选元素的文本内容;
   console.log($('p').text()) 
   // $('p').mouseover(function(){
   //   $(this).text('~ 我是灭绝小师太! ~')
   // })
   //html()设置或返回所选元素的内容(包括 HTML 标记)
   console.log($('p').html())
    //val()设置或返回表单字段的值;
    console.log($('input').val())
    $('input').click(function(){
      $(this).val('请请输入关键词....')
    })
   })

  </script>
  <style type="text/css">
  *{margin:0;padding:0;}
  p{width:300px;height:300px;line-height: 300px;background:#9BF25A;margin:20px auto;text-align: center;}
  form{width: 450px;margin: 20px auto;}
  input{width: 450px;height: 35px;}
  </style>
</head>
<body>
   <p>
     欢迎来到<a href="">0133技术站!</a> 
   </p>
  <form>
    <input type="text" value="你好">
  </form>
</body>
</html>


任务

?不会了怎么办
无数据提示暂无评论哟...我要评论
网站导航
标签地图
学习路径
视频教程
开发软件
旗下子站
php中文网
phpstudy
技术文章
文档工具
关于我们
企业合作
人才招聘
联系我们
讲师招募
QQ交流群
QQ官方交流群
微信公众号
微信公众号