jQuery
来源:互联网 发布:手机淘宝卖家怎么激活 编辑:程序博客网 时间:2024/06/06 05:02
jQuery基础选择器
层次选择器
索引选择器
内容选择器
可见性选择器
属性选择器
表格列选择器
表单选择器
|NO|选择器|描述|返回类型|
|1|:input|取得所有的输入组件对象。如text、radio|元素组合|
|2|:text|取得所有的文本输入框元素|元素集合|
|3|:password|取得所有的密码输入组件|元素集合|
|4|:radio|取得所有的单选框|元素集合|
|5|:CheckBox|取得所有的复选框|元素集合|
|6|:button|取得所有的按钮|元素集合|
|7|:submit|取得所有的提交按钮|元素集合|
|8|:reset|取得所有的重置按钮|元素集合|
|9|:file|取得所有的上传组件|元素组件|
|10|:image|取得图片按钮|元素集合|
|11|:hidden|取得所有的隐藏域|元素集合|
DOM操作函数
事件选择
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>jQuery练习</title><script type="text/javascript" src="jquery/jquery-3.2.1.min.js"></script><script type="text/javascript"> $(function() { $("button[id^='dept']").each(function(){ $(this).on("click",function(){ deptno=this.id.split("-")[1]; $("#dept-"+deptno).text("新部门-"+deptno); }); }); })</script></head><body> <div> <span id="dept-1">部门1</span>: <button id="dept-1">编辑</button> <br> <span id="dept-2">部门2</span>: <button id="dept-2">编辑</button> <br> <span id="dept-3">部门3</span>: <button id="dept-3">编辑</button> <br> </div></body></html>
Ajax处理
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>jQuery练习</title><script type="text/javascript" src="jquery/jquery-3.2.1.min.js"></script><script type="text/javascript"> /* $(function() { $(sendBut).on("click",function(){ $.ajax({//这里面需要将所有要发送的数据以JSON的形式发送 url : "echo", method : "post", data : { name : "hello", msg : "你好" }, dataType : "text" , success : function(){ console.log("操作处理成功," ); }, error : function(){ console.log("操作失败"); }, }); }); }) */ $(function() { $(sendBut).on("click", function() { $.get("echo", { name : "hello", msg : "你好" }, function(data) { console.log(data); }, "text"); }); })</script></head><body> <div id="myDiv"></div> <button id="sendBut">回应</button></body></html>
0 0
- JQuery
- JQuery
- JQuery
- JQuery
- JQuery
- JQuery
- JQuery
- JQuery
- JQuery
- JQuery
- JQuery
- JQuery
- JQuery
- JQUERY
- jquery
- jQuery
- jquery
- jquery
- Flask中的Jinja2模板使用
- 单例设计模式
- 万达电商折戟之谜
- Oracle学习笔记(四)
- 你大概走了假敏捷:认真说说敏捷的实现和问题(手绘版)
- jQuery
- mongodb查看数据库和表的信息
- 08_代码结构
- NYOJ 188 Arbitrage map 建图 汇率转换
- Spring 面试题总结
- 如何快速重装win10系统?
- mongodb允许远程访问
- 算步数-数学题
- SVN Working Copy locked ,并且进行clean up也还是不行