10 examples of 'document onclick jquery' in JavaScript

Every line of 'document 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
64function DocumentClick (clickEvent)
65{
66 var floating = document.getElementById ('floating');
67 var isInFloating = false;
68
69 var target = clickEvent.target;
70 while (target !== null) {
71 if (target === floating) {
72 isInFloating = true;
73 break;
74 }
75 target = target.parentElement;
76 }
77
78 if (!isInFloating) {
79 if (floating.style.display !== 'none') {
80 floating.style.display = 'none';
81 }
82 }
83}
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

350function DocumentClick (clickEvent)
351{
352 var floating = document.getElementById ('floating');
353 var exporttext = document.getElementById ('exporttext');
354 var svgcontent = document.getElementById ('svgcontent');
355 var isInFloating = false;
356
357 var target = clickEvent.target;
358 while (target !== null) {
359 if (target === floating) {
360 isInFloating = true;
361 break;
362 }
363 target = target.parentElement;
364 }
365
366 if (!isInFloating) {
367 if (floating.style.display !== 'none') {
368 floating.style.display = 'none';
369 exporttext.style.display = 'none';
370 svgcontent.style.display = 'none';
371 }
372 }
373}
229function testDocumentClick () {
230 var clicks = 0
231 $(document).on('click', function () {
232 clicks++
233 })
234 $('body').trigger('click')
235 test.equals(1, clicks)
236}
279function blockLinksOnClick (event) {
280 if (
281 event.target.nodeName === 'A' &&
282 event.target.getAttribute('href').indexOf('http') === 0
283 ) {
284 event.preventDefault()
285 }
286}
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},
12function onClick (e, href) {
13 e.preventDefault()
14 window.getGlobal('openExternal')(href)
15}
45document.querySelector('button[name="select"]').addEventListener('click', function onClick(event) {
46 chooser.click();
47});
34onclick: function onclick(e) {
35 jQuery(this).closest('.form__field-description').parent().find('.toggle-content').toggle();
36 return false;
37}
30onClick (callback) {
31 this.element.addEventListener('click', callback)
32}
17function click (e) {
18 e.preventDefault()
19 alert(message)
20}

Related snippets