10 examples of 'jquery data selector' in JavaScript

Every line of 'jquery data selector' 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
11function jqmDataSelector( expression ) {
12 return "[data-" + $.mobile.ns + expression + "]";
13}
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 toDataSelector(selector) {
43 if (/[\]['"()]/.test(selector))
44 throw new Error("selector is too complex");
45
46 var parts = selector.split(separator_re);
47 var ret = [];
48 for(var i = 0; i < parts.length; ++i) {
49 var part = parts[i];
50 if (part.length) {
51 if (separators.indexOf(part) > -1)
52 ret.push(part);
53 else if (/[a-zA-Z]/.test(part[0])) {
54 part = part.trim();
55 var name_split = part.split(/(.#)/);
56 ret.push(util.classFromOriginalName(name_split[0]));
57 ret = ret.concat(name_split.slice(1));
58 }
59 else
60 ret.push(part);
61 }
62 }
63 return ret.join("");
64}
82function setupSelector(selector) {
83
84 // process new selector value when selector loses focus
85 selector.bind('blur', function(e) {
86 selector.autocomplete('close');
87 });
88
89 // set autocomplete to trigger blur (remove focus)
90 selector.autocomplete({
91 select: function(event, ui) {
92 selector.val(ui.item.value);
93 selector.blur();
94 },
95 delay: 0,
96 minLength: 0
97 });
98
99 // set enter key to trigger blur (remove focus)
100 selector.bind('keypress.enterkey', function(e) {
101 if (e.which === 13) {
102 selector.blur();
103 handleResponse(true);
104 }
105 });
106}
23function $(selector) {
24 return jQuery(selector, element);
25}
14function query(selector, context) {
15 /* jshint -W103 */
16 var ret = root(selector, context);
17 ret._$ = $;
18
19 // We need to remap ourselves to the private context and unfortunately
20 // the return behavior of the Cheerio constructo makes this difficult to
21 // implement without ramapping after the fact.
22 ret.__proto__ = $.fn;
23 return ret;
24}
1244function dataFindAll(node, selector) {
1245 var gui_selector = toGUISelector(selector);
1246 var gui_node = $.data(node, "wed_mirror_node");
1247 var found_nodes = gui_node.querySelectorAll(gui_selector);
1248 var ret = [];
1249 for(var i = 0, found_node; (found_node = found_nodes[i]); ++i)
1250 ret.push($.data(found_node, "wed_mirror_node"));
1251 return ret;
1252}
110$(selector) {
111 return this.$el.find(selector)
112}
4function updateSelect(data, selector, id_attr, value_attr) {
5 var _select_tag = $(selector)[0];
6 var new_options = '';
7
8 // in some cases, e.g. TestRun search, the 1st <option> element is ---
9 // which must always be there to indicate nothing selected
10 if (_select_tag.options.length) {
11 new_options = _select_tag.options[0].outerHTML;
12 }
13
14 data.forEach(function(element) {
15 new_options += '<option value="' + element[id_attr] + '">' + element[value_attr] + '</option>';
16 });
17
18 _select_tag.innerHTML = new_options;
19
20 try {
21 $(selector).selectpicker('refresh');
22 } catch(e) {
23 console.warn(e);
24 }
25}
1314function dataFindAll(node, selector) {
1315 var gui_selector = toGUISelector(selector);
1316 var gui_node = $.data(node, "wed_mirror_node");
1317 var found_nodes = gui_node.querySelectorAll(gui_selector);
1318 var ret = [];
1319 for (var i = 0; i < found_nodes.length; ++i) {
1320 ret.push($.data(found_nodes[i], "wed_mirror_node"));
1321 }
1322 return ret;
1323}
218_selector_exists() {
219 return $(this.chart_selector).length > 0;
220}

Related snippets