What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-12 18:06:14
change the focus to next in angular forms
import { Directive, ElementRef, HostListener, Input } from '@angular/core'; @Directive({ selector: '[moveNextByMaxLength]' }) export class MoveNextByMaxLengthDirective { constructor(private _el: ElementRef) { } @HostListener('keyup', ['$event']) onKeyD... Add solution -
Javascript 2021-11-12 15:59:12
jquery dynamic row number not working properly
$(function() { function numberRows($t) { var c = 0; $t.find("tr").each(function(ind, el) { $(el).find("td:eq(0)").html(++c + "."); }); } $("#add-service-button").click(function(e) { e.pre... Add solution -
Javascript 2021-11-12 13:08:14
js scroll page horizontally with mouse wheel
(function() { function scrollHorizontally(e) { e = window.event || e; var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail))); document.getElementById('yourDiv').scrollLeft -= (delta * 40); // Multiplied by 40 ... Add solution -
Javascript 2021-11-12 09:36:11
jquery link click scroll
// Select all links with hashes $('a[href*="#"]') // Remove links that don't actually link to anything .not('[href="#"]') .not('[href="#0"]') .click(function(event) { // On-page links if ( location.pathn... Add solution -
Javascript 2021-11-11 10:05:18
how to prevent the form from getting automatically submitted javascript
//add event.preventDefault() example, function clickHandler(event){ alert("Hey you clicked the submit button"); event.preventDefault(); } //this will prevent the page from getting automatically refreshed after //the submit button is hit. Add solution -
Javascript 2021-11-11 05:14:12
jquery ajax form submission
// jQuery ajax form submit example, runs when form is submitted $("#myFormID").submit(function(e) { e.preventDefault(); // prevent actual form submit var form = $(this); var url = form.attr('action'); //get submit url [replace ur... Add solution -
Javascript 2021-11-10 15:22:15
javascript get form data as json
function handleSubmit(event) { event.preventDefault(); const data = new FormData(event.target); + const value = Object.fromEntries(data.entries()); console.log({ value }); } const form = document.querySelector('form'); form.addEventListene... Add solution