JQuery-change/select/submit
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>change/select/submit</title>
</head>
<body>
<form action="www.baidu.com" method="get">
<input type="text" value="123">
<input type="submit" value="提交"></input>
</form>
<select name="alex" id="">
<option selected>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option> </select>
<script src="js/jQuery3.3.1.js"> </script>
<script>
$(function () {
$("input[type=text]").focus() ; //获取焦点
$("input[type=text]").change( //change(表单控件的value发生改变时候)
function () {
console.log($("input[type=text]").val())
}
);
$("input[type=text]").select(function () { //select 文本被选中
console.log("选中了")
});
$("select").change(
function () {
console.log($("select").find("option:selected").text()) //获取选中的值 需要获取select才能获取option
}
); $("form").submit( //表单控件提交 是 获取表单事件
function () {
alert(`确认提交?`)
}
)
})
</script>
</body>
</html>
JQuery-change/select/submit的更多相关文章
- 通过jquery触发select自身的change事件
###通过jquery触发select自身的change事件 1.通过js来去触发select的change事件 代码如下:包含了html部分和js部分 //html部分 <select cla ...
- jQuery取得select选择的文本与值
jquery获取select选择的文本与值获取select :获取select 选中的 text :$("#ddlregtype").find("option:selec ...
- JQuery 绑定select标签的onchange事件,弹出选择的值,并实现跳转、传参
<script src="jquery.min.js" type="text/javascript"></script> <scr ...
- jquery中select的应用
//得到select项的个数 jQuery.fn.size = function(){ return jQuery(this).get(0).options.length; } //获得选中项的索引 ...
- 简单jquery实现select三级联动
简单的jquery实现select三级联动 代码如下: <!DOCTYPE html> <html> <head> <meta charset="u ...
- jquery操作select(取值,设置选中)
最近工作中总出现select 和 option问题,整理一下,内容大部分源于网络资料 一.基础取值问题 例如<select class="selector"></ ...
- jquery获得select option的值 和对select option的操作
jQuery获取Select元素,并选择的Text和Value: 1. $("#select_id").change(function(){//code...}); //为Se ...
- [荐] jQuery取得select选择的文本与值
csdn:http://blog.csdn.net/tiemufeng1122/article/details/44154571 jquery获取select选择的文本与值获取select :获取se ...
- Jquery获取select,dropdownlist,checkbox下拉列表框的值
jQuery获取 Select选择的Text和Value: 语法解释: 1. $("#select_id").change(function(){//code...}); ...
随机推荐
- A1094. The Largest Generation
A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level bel ...
- JavaScript深入之执行上下文栈
如果要问到 javascript 代码执行顺序的话,想必写过javascript的开发者都会有个直观的印象,那就是顺序执行,例如: var foo = function(){ console.log( ...
- Django 分页器的使用
Django 分页器的使用 Django作为Python Web开发框架的一哥,提供了企业级网站开发所需要的几乎所有功能,其中就包括自带分页功能.利用Django自带的Paginator类,我们可以很 ...
- Win32 SDK:ListBox 为什么不整个 LB_SETTEXT
Win32 & SDK: ListBox 有个 LB_GETTEXT,为什么没有 LB_SETTEXT,想修改指定Item的Text,还真不容易. 自已写了一个,支持单选和多选模式,部分代码: ...
- Remote debugger is in a background tab which may cause apps to perform slowly. Fix this by foregrounding the tab (or opening it in a separate window).
先上代码: /** * Sample React Native App * https://github.com/facebook/react-native * * @format * @flow * ...
- Windows android SDK环境配置及判断安装成功
- 洛谷 P2622 关灯问题II(状压DP入门题)
传送门 https://www.cnblogs.com/violet-acmer/p/9852294.html 题解: 相关变量解释: int n,m; ];//a[i][j] : 第i个开关对第j个 ...
- 42套JavaScript深度解析教学视频!合集
本文首发于:风云社区SCOEE(社区旨在普惠软件.图片.音乐.视频.素材.文档等互联网资源.为大众提供多样化的服务,以及主要涵盖学术科学.电脑技术.文化人文.体育健身等领域的知识和信息,获得用户的支持 ...
- Java概念、语法和变量基础整理
Java概述 J2SE: Java 2 Platform Standard Edition( 2005年之后更名为Java SE ).包含构成Java语言核心的类 J2EE: Java 2 Plat ...
- OS + linux proxy
s Linux主机通过代理服务器进行网络连接 http://www.linuxidc.com/Linux/2015-01/111703.htm 新手用Linux做代理服务器 三招搞定 http://b ...