10 examples of 'onclick div' in JavaScript

Every line of 'onclick div' 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
74function divOnclickHandler(elem){
75 if (elem === document.getElementById('theDIV'))
76 window.top.eCounters["div onclick"] += 1;
77}
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

289function bindBlockClick(div, callback) {
290 jQuery("div.ganttview-block", div).on("dblclick", function () {
291 if (callback) { callback(jQuery(this).data("block-data")); }
292 });
293}
19function onClick (evt) {
20 var box = evt.target;
21 if (box.getAttribute ("sosa") != 1) {
22 var num = box.getAttribute ("sosa");
23 var id = (num < 0) ? data.children[-1 - num].id : data.sosa[num].id;
24 var startX = (data.children ? boxWidth + horizPadding : 0) + 1;
25 var delay = 200;
26 $(box.parentNode).animate ({'svg-x':startX, 'svg-y':tops[0]}, delay);
27 setTimeout (function() {getPedigree ({id:id});return false}, delay);
28 }
29}
75function onClick(event) {
76 event.preventDefault();
77 var self = this,
78 forward = (self.className.indexOf('pagMore') > -1),
79 parent = self.parentElement,
80 prev = (forward) ? parent.getElementsByClassName('pagLess')[0] : self,
81 prevBatch = ~~(prev.getAttribute('data-batch')),
82 next = (forward) ? self : parent.getElementsByClassName('pagMore')[0],
83 nextBatch = prevBatch + 2,
84 batch = (forward) ? nextBatch : prevBatch,
85 add = (forward ? 1 : -1),
86 id = parent.id,
87 container = parent.getElementsByTagName('ul')[0];
88
89 prev.setAttribute('data-batch', prevBatch + add);
90 next.setAttribute('data-batch', nextBatch + add);
91
92 throbber.show(self, {size: '40px'});
93
94 self.className += ' active';
95
96 nirvana.sendRequest({
97 controller: 'WikiaMobile',
98 method: 'getCategoryBatch',
99 format: 'html',
100 type: 'GET',
101 data: {
102 category: wgTitle,
103 batch: batch,
104 //this is already encoded and $.ajax encode all data
105 index: decodeURIComponent(id.slice(8))
106 }
107 }).done(
108 function (result) {
109 container.parentElement.removeChild(container);
110 next.insertAdjacentHTML('beforebegin', result);
111
112 if (forward) {
113 parent.previousElementSibling.scrollIntoView();
114 track.event('category', track.PAGINATE, {label: 'next'});
115 } else {
116 track.event('category', track.PAGINATE, {label: 'previous'});
117 }
118
119 throbber.hide(self);
120
121 prev.className = 'pagLess' + (batch > 1 ? ' visible' : '');
122 next.className = 'pagMore' + (batch < ~~(parent.getAttribute('data-batches')) ? ' visible' : '');
123 }
124 );
125}
164function handleClick(evt){
165 state = lastState = 0;
166 problem = new OnlineDfsAgentProblemStatement();
167 agent = new OnlineDfsAgent(problem);
168 m_frame = DELAY;
169}
6function onClick() {
7 const diff: HTMLElement = ((this: HTMLButtonElement).closest(
8 '.bb-udiff'
9 ): any)
10 const { filename } = diff.dataset
11 copy(filename)
12}
144function appendDIV(event) {
145 var div = document.createElement('div');
146 div.innerHTML = event.data || event;
147 chatContainer.insertBefore(div, chatContainer.firstChild);
148 div.tabIndex = 0;
149 div.focus();
150
151 document.getElementById('input-text-chat').focus();
152}
82function clicked(d) {
83 var x, y, k;
84
85 if (d && centered !== d) {
86 var centroid = path.centroid(d);
87 x = centroid[0];
88 y = centroid[1];
89 k = 2;
90 centered = d;
91 } else {
92 x = width / 2;
93 y = height / 2;
94 k = 1;
95 centered = null;
96 }
97
98 g.selectAll("path")
99 .classed("active", centered && function(d) { return d === centered; });
100
101 g.transition()
102 .duration(750)
103 .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")scale(" + k + ")translate(" + -x + "," + -y + ")")
104 .style("stroke-width", 1.5 / k + "px");
105}
34onclick: function onclick(e) {
35 jQuery(this).closest('.form__field-description').parent().find('.toggle-content').toggle();
36 return false;
37}
401elLink.addEventListener("mousedown", function onClick(e) {
402 e.stopPropagation();
403 e.preventDefault();
404});

Related snippets