10 examples of 'jquery find first element' in JavaScript

Every line of 'jquery find first element' 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
55export function find () {
56 return $('.frost-button')
57}
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

42function find(element) {
43 for (var i = 0; i < this.dataStore.length; ++i) {
44 if (this.dataStore[i] == element) {
45 return i;
46 }
47 }
48 return -1;
49}
28function find(element) {
29 for (var i = 0; i < this.dataStore.length; ++i) {
30 if (this.dataStore[i] == element) {
31 return i;
32 }
33 }
34 return -1;
35}
54function getElement(element) {
55
56 if (periodic_table[element] !== undefined) {
57 return periodic_table[element];
58 } else {
59 return null;
60 }
61}
99function findParent ($elt, className) {
100 while ($elt) {
101 if ($elt.hasClass(className))
102 return $elt;
103 $elt = $elt.parent();
104 }
105 return null;
106}
33function findElement(element, test) {
34
35 if (test(element)) {
36 return element;
37 }
38 for (var i = 0; i < element.children().length; i++) {
39 var result = findElement(element.children[i], test);
40 if (result) {
41 return;
42 }
43 }
44 return null;
45}
243function getFirstChildElement(element) {
244 if (element.firstElementChild) {
245 return element.firstElementChild;
246 } else {
247 var node = element.firstChild;
248 while (node && 1 !== node.nodeType) {
249 node = node.nextSibling;
250 }
251 return node;
252 }
253}
73function _insertBeforeFirst($container, selector, elem) {
74 const foundElems = $container.find(selector);
75 if (foundElems.length > 0) {
76 foundElems.eq(0).before(elem);
77 } else {
78 $container.append(elem);
79 }
80}
22export function closest(element: Element, selector: string): Element | null {
23 return closestCallback(element, (el: Element) => matches.call(el, selector))
24}
12function closest(element, selector) {
13 var matchesFn;
14
15 // find vendor prefix
16 ['matches', 'msMatchesSelector'].some(function(fn) {
17 if (typeof document.body[fn] == 'function') {
18 matchesFn = fn;
19 return true;
20 }
21 return false;
22 })
23
24 var parent;
25
26 // Traverse parents
27 while (element) {
28 parent = element.parentElement;
29 if (parent && parent[matchesFn](selector)) {
30 return parent;
31 }
32 element = parent;
33 }
34
35 return null;
36}

Related snippets