10 examples of 'jquery get value of button' in JavaScript

Every line of 'jquery get value of button' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
72getButtonValue(button) {
73 if (typeof button === "object") {
74 return button;
75 }
76
77 return {
78 pressed: button === 1.0,
79 value: button
80 };
81}
13function getValue() {
14 var tel = $('#tel').val();
15 var password = $('#password').val();
16 var code = $('#imgcode').val();
17
18 // 验证邮箱
19 if (!testData(tel, 'mobile')) {
20 $.tip({
21 msg: '请输入正确的手机!',
22 type: 'danger',
23 time: 3000
24 });
25 return false;
26 }
27
28 // 验证密码
29 if (password === '') {
30 $.tip({
31 msg: '密码不能为空!',
32 type: 'danger',
33 time: 3000
34 });
35 return false;
36 }
37
38 if(code === '') {
39 $.tip({
40 msg: '验证码不能为空',
41 type: 'danger',
42 time: 3000
43 });
44 return false;
45 }
46
47 return {
48 tel: tel,
49 code: code,
50 password: password
51 }
52}
381function get_value(id) {
382 return document.getElementById(id).value;
383}
3function get_value(div){
4 return document.getElementById(div).value;
5}
122function getValue(value) {
123 var webApiEndpoint = setApiEndpoint('get_value')
124
125 $.ajax({
126 url: webApiEndpoint+"/"+value,
127 type: 'GET',
128 dataType: 'text',
129 cache: false,
130 }).done(function(data){
131 if (data.match(/^null$/)) {
132 $('.get-result').text("No data: "+value+ " don't have value.");
133 } else {
134 $('.get-result').text("Value: "+data);
135 }
136
137 }).fail(function(){
138 alert("fail to access Gladiator Web API");
139 });
140}
83function getValue(element) {
84 var inputType = element.getAttribute('type');
85
86 switch (inputType) {
87 case 'checkbox':
88 return element.checked;
89
90 default:
91 return element.value;
92 }
93}
272function getButtonVia(element) {
273 if (typeof $(element).data('via') !== 'undefined') {
274 return $(element).data('via');
275 } else {
276 return '';
277 }
278}
96function getValue(sName)
97{
98 return(document.getElementById(sName).value);
99}
104function getElementByIdValue() {
105 detectedTransport = null;
106 return document.getElementById(arguments[0]).value;
107}
31function getElementByIdValue()
32{
33 return document.getElementById(arguments[0]).value;
34}

Related snippets