10 examples of 'jquery get value' in JavaScript

Every line of 'jquery get value' 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
this disclaimer
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}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

301jQuery.fn.val = (function val(value) {
302 let result = jQueryOriginalVal.apply(this, arguments);
303 if (arguments.length == 1 && this.hasClass("persian-date-picker-value")) {
304 this.trigger("change");
305 }
306 return result;
307}) as any;
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}
69function get () {
70 if (code_mirror) {
71 return code_mirror.getValue();
72 } else {
73 return $html_area.val();
74 }
75}
69function get () {
70 if (code_mirror) {
71 return code_mirror.getValue();
72 }
73 else {
74 return $html_area.val();
75 }
76}
41function getValue() {
42 return $(dropdownId).val();
43}
3function set(el, value) {
4 $(el).val(value);
5 $('#' + $(el).data("target")).val(value);
6
7}
381function get_value(id) {
382 return document.getElementById(id).value;
383}
3function get_value(div){
4 return document.getElementById(div).value;
5}
92reg: /^height:(\d+)px/g, setValue: function setValue(v) {
93 $("#height").val(v);
94}

Related snippets