8 examples of 'if else in jquery' in JavaScript

Every line of 'if else in jquery' 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
589function hasJQueryData(object) {
590 var data = evalJQueryData(object);
591 for (var x in data) {
592 if (data.hasOwnProperty(x)) {
593 return data;
594 }
595 }
596};
28function isJqueryObject(oObj) {
29 var isJquery = false;
30 if(root.jQuery)
31 {
32 isJquery = oObj instanceof root.jQuery;
33 }
34 return isJquery;
35
36}
72function elsif (ifThens, target, parser) {
73 for (var i = 0, l = ifThens.length; i < l; i++) {
74 var ifThen = ifThens[i]
75 , ifFn = ifThen[0]
76 , thenFn = ifThen[1];
77 if (ifFn(target)) {
78 thenFn(target, parser);
79 return true;
80 }
81 }
82 return false;
83}
384function isJqueryObject(obj) {
385
386 return obj instanceof jQuery;
387}
369function is_element_visible(jq_element) {
370 // Returns true if jq_element is currently on the visible part of
371 // the html page.
372
373 // element must not be hidden
374 if (!jq_element.is(":visible")) return false;
375 // element is invisible if its bottom is above the top of the window
376 if ((jq_element.offset().top + jq_element.height()) < $(window).scrollTop()) return false;
377 // or its top below the bottom of the window
378 if (jq_element.offset().top > ($(window).scrollTop() + $(window).height())) return false;
379 return true;
380}
57function showIf(condition, el) {
58 return condition ? el : null;
59}
57function _if(el, value, directive) {
58 remove(el, directive);
59 beforeText(el, `\${${value} ? `);
60 const rElse = el.nextElementSibling;
61 if (rElse && has(rElse, 'else')) {
62 wrapAround(el, `\``, `\``);
63 remove(rElse, 'else');
64 wrapAround(rElse, `:\``, `\`}`);
65 } else {
66 wrapAround(el, `\``, `\`:\`\`}`);
67 }
68}
633function returnTrue() {
634 return true;
635}

Related snippets