10 examples of 'angularjs add class onclick' in JavaScript

Every line of 'angularjs add class onclick' 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
72function addCssClass(className) {
73 if (className) {
74 if (isClassListSupported) {
75 panel.classList.add(className);
76 } else {
77 panel.className += ' ' + className;
78 }
79 }
80}
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

133private onClick(event: MouseEvent): void {
134 this.event.$emit('click', event);
135}
20function onclick() {
21 window.open(url, '_system');
22 return false;
23}
281function onClick(event) {
282 if (Date.now() - lastPreventedTime > PREVENT_DURATION) {
283 return; // Too old.
284 }
285
286 var touches = event.touches && event.touches.length ? event.touches : [event];
287 var x = touches[0].clientX;
288 var y = touches[0].clientY;
289 // Work around desktop Webkit quirk where clicking a label will fire two clicks (on the label
290 // and on the input element). Depending on the exact browser, this second click we don't want
291 // to bust has either (0,0) or negative coordinates.
292 if (x < 1 && y < 1) {
293 return; // offscreen
294 }
295
296 // Look for an allowable region containing this click.
297 // If we find one, that means it was created by touchstart and not removed by
298 // preventGhostClick, so we don't bust it.
299 if (checkAllowableRegions(touchCoordinates, x, y)) {
300 return;
301 }
302
303 // If we didn't find an allowable region, bust the click.
304 event.stopPropagation();
305 event.preventDefault();
306
307 // Blur focused form elements
308 event.target && event.target.blur();
309}
15constructor(el: ElementRef) {
16 this.el = el.nativeElement;
17 this.el.style.transition = 'background-color .2s ease-out';
18}
48public onClick() {
49 const {disabled} = this;
50 if (disabled) {
51 return;
52 }
53 const isSelect = this.state.selected;
54 this.state.selected = !isSelect;
55 this.$emit('change', !isSelect);
56}
23public add(...classNames: string[]): void {
24 const attr = this.ownerElement.getAttribute('class');
25 const list = attr ? attr.split(' ') : [];
26 for (const className of classNames) {
27 if (!list.includes(className)) {
28 list.push(className);
29 }
30 }
31 this.ownerElement.setAttribute('class', list.join(' '));
32}
12public onClick() {
13 this.$emit('click');
14}
18function addClass(className) {
19 this.classList.add(className);
20
21 return this;
22}
42element.bind('click', function onClick() {
43
44 // Invoke the `clickFn` callback when the element has been clicked.
45 clickFn.call(this, scope, $window.document);
46 scope.$apply();
47
48});

Related snippets