10 examples of 'onclick jquery' in JavaScript

Every line of 'onclick 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
this disclaimer
34onclick: function onclick(e) {
35 jQuery(this).closest('.form__field-description').parent().find('.toggle-content').toggle();
36 return false;
37}
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

61function onClick() {
62 const currentTarget =
63 $navlist.find('.tabcordion_nav-item.is-active .tabcordion_nav-trigger')[0];
64 if (currentTarget != $(this)[0]) {
65 const eventData = { 'previousTarget': currentTarget, 'newTarget': $(this)[0] };
66 const event = new CustomEvent('rb.tabcordion.tabChanged', { detail: eventData });
67 $tabcordion[0].dispatchEvent(event);
68 }
69
70 setActiveAndInactive(this, $navlist);
71}
145function onClick(e) {
146 var el = e.target
147
148 // Ignore command click, control click, and non-left click
149 if (e.metaKey || e.which !== 1) return
150
151 // Ignore if already prevented
152 if (e.defaultPrevented) return
153
154 // Also look up for parent links (<a><img></a>)
155 while (el) {
156 var url = el.href
157 if (url) {
158
159 // Ignore if created by Tracks
160 if (el.hasAttribute && el.hasAttribute('data-router-ignore')) return
161
162 // Ignore links meant to open in a different window or frame
163 if (el.target && el.target !== '_self') return
164
165 // Ignore hash links to the same page
166 var hashIndex = url.indexOf('#')
167 if (~hashIndex && url.slice(0, hashIndex) === window.location.href.replace(/#.*/, '')) {
168 return
169 }
170
171 e._tracksLink = el
172 history.push(url, true, null, e)
173 return
174 }
175
176 el = el.parentNode
177 }
178}
12function onClick (e, href) {
13 e.preventDefault()
14 window.getGlobal('openExternal')(href)
15}
408onclick: function onclick(e) {
409 var self = this,
410 editform = self.closest('.ss-uploadfield-item').find('.ss-uploadfield-item-editform'),
411 itemInfo = editform.prev('.ss-uploadfield-item-info'),
412 iframe = editform.find('iframe');
413
414 if (iframe.parent().hasClass('loading')) {
415 e.preventDefault();
416 return false;
417 }
418
419 if (iframe.attr('src') == 'about:blank') {
420 var disabled = this.siblings();
421
422 iframe.attr('src', iframe.data('src'));
423
424 iframe.parent().addClass('loading');
425 disabled.addClass('ui-state-disabled');
426 disabled.attr('disabled', 'disabled');
427
428 iframe.on('load', function () {
429 iframe.parent().removeClass('loading');
430
431 if (iframe.data('src')) {
432 self._prepareIframe(iframe, editform, itemInfo);
433 iframe.data('src', '');
434 }
435 });
436 } else {
437 self._prepareIframe(iframe, editform, itemInfo);
438 }
439
440 e.preventDefault();
441 return false;
442},
111onclick: function onclick(e) {
112 e.preventDefault();
113 this.closest('.field').toggleEdit(true);
114}
451onclick: function onclick(e) {
452 this.parent().find('.active').removeClass('active');
453 this.next('label').addClass('active');
454
455 var targetStateName = $(this).attr('data-name');
456
457 $('.cms-preview').changeState(targetStateName);
458}
279function blockLinksOnClick (event) {
280 if (
281 event.target.nodeName === 'A' &&
282 event.target.getAttribute('href').indexOf('http') === 0
283 ) {
284 event.preventDefault()
285 }
286}
125onclick: function onclick(e) {
126 e.preventDefault();
127 this.closest('.field').cancel();
128}
30onClick (callback) {
31 this.element.addEventListener('click', callback)
32}

Related snippets