10 examples of 'jquery disable textbox' in JavaScript

Every line of 'jquery disable textbox' 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
2function setActiveTextBox(field, cssClass, text) {
3 var fieldObj = document.getElementById(field);
4 fieldObj.className = cssClass;
5 if (fieldObj.value == text) {
6 fieldObj.value = '';
7 return true;
8 }
9}
481function handleKeyTextbox(target, keyCode, altKey) {
482 var combo;
483 /* keydown happens when a combo input is focused */
484 if (keyCode === KeyEvent.DOM_VK_TAB) {
485 // TAB out, do nothing, focus will take care of it.
486 return false;
487 }
488
489 combo = getCombo(target);
490 if (!combo) {
491 return false;
492 }
493
494 switch (keyCode) {
495 case KeyEvent.DOM_VK_ESCAPE:
496 if (shed.isExpanded(combo)) {
497 shed.collapse(combo);
498 return true;
499 }
500 break;
501 case KeyEvent.DOM_VK_DOWN:
502 doDownButton(combo, altKey);
503 break;
504 case KeyEvent.DOM_VK_UP:
505 doUpKey(combo, altKey);
506 break;
507 default:
508 if (filter && (!key.isMeta(keyCode)) && !CHATTY_COMBO.isOneOfMe(combo)) {
509 filterOptions(combo);
510 }
511 }
512 return false;
513}
49function disableSelect(chkbox) {
50 var sibling = chkbox;
51 while (sibling != null) {
52 if (sibling.nodeType == 1 && sibling.tagName.toLowerCase() == "select") {
53 $(sibling).prop('disabled', !chkbox.checked);
54 }
55 sibling = sibling.previousSibling;
56 }
57}
7function disabletext(e){
8return false
9}
415function disableEnterKey() {
416 $(window).keydown(function(event){
417 if(event.keyCode == 13) {
418 event.preventDefault();
419 return false;
420 }
421 });
422}
333function onBlur(elt) {
334 if (/^ *$/i.test(elt.value)) {
335 elt.value = elt.defaultValue;
336 }
337}
10function disable($element) {
11 $element.prop("disabled", "disabled");
12}
310function DisableInputs() {
311 $("input").each(function () {
312 $(this).fadeOut(300).fadeIn(150);
313 $(this).delay(455).prop("disabled", true);
314 });
315 $(".button").each(function () {
316 $(this).fadeOut(300).fadeIn(150);
317 $(this).delay(455).addClass("disabled");
318 });
319 cookie.set("_input", "disabled", { expires: 7 });
320}
74function resetKeyTextbox(textbox, value, tooltip, dontShorten) {
75 textbox.classList.remove("key-updating");
76
77 if (value) {
78 textbox.value = dontShorten ? value : value.slice(-8);
79 textbox.classList.remove("key-invalid", "key-success", "key-missing");
80 }
81 else {
82 textbox.value = "No key";
83 textbox.classList.remove("key-invalid", "key-success");
84 textbox.classList.add("key-missing");
85 }
86
87 textbox.hasKey = Boolean(value);
88
89 if (tooltip) {
90 textbox.title = tooltip;
91 }
92 else {
93 textbox.removeAttribute("title");
94 }
95};
2export function enableInputBlurring() {
3 const doc = document;
4 let focused = true;
5 let didScroll = false;
6 function onScroll() {
7 didScroll = true;
8 }
9 function onFocusin() {
10 focused = true;
11 }
12 function onTouchend(ev) {
13 // if app did scroll return early
14 if (didScroll) {
15 didScroll = false;
16 return;
17 }
18 const active = doc.activeElement;
19 if (!active) {
20 return;
21 }
22 // only blur if the active element is a text-input or a textarea
23 if (active.matches(SKIP_SELECTOR)) {
24 return;
25 }
26 // if the selected target is the active element, do not blur
27 const tapped = ev.target;
28 if (tapped === active) {
29 return;
30 }
31 if (tapped.matches(SKIP_SELECTOR) || tapped.closest(SKIP_SELECTOR)) {
32 return;
33 }
34 focused = false;
35 // TODO: find a better way, why 50ms?
36 setTimeout(() => {
37 if (!focused) {
38 active.blur();
39 }
40 }, 50);
41 }
42 doc.addEventListener('ionScrollStart', onScroll);
43 doc.addEventListener('focusin', onFocusin, true);
44 doc.addEventListener('touchend', onTouchend, false);
45 return () => {
46 doc.removeEventListener('ionScrollStart', onScroll, true);
47 doc.removeEventListener('focusin', onFocusin, true);
48 doc.removeEventListener('touchend', onTouchend, false);
49 };
50}

Related snippets