• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
JavaScriptSource

JavaScriptSource

Search 5,000+ Free JavaScript Snippets

  • Home
  • Browse Snippets
    • Addon
    • Ajax
    • Buttons
    • Cookies
    • CSS
    • Featured
    • Forms
    • Games
    • Generators
    • Image Effects
    • Math Related
    • Miscellaneous
    • Multimedia
    • Navigation
    • Page Details
    • Passwords
    • Text Effects
    • Time & Date
    • User Details

Make a resizable element

Make a resizable element

First, we need to prepare some elements that indicate the element is resizable. They are placed absolutely at the four sides of the original element.

Miscellaneous

Convert a string into an integer (a whole number)

Convert a string into an integer (a whole number)

Convert a string into an integer (a whole number).

Math Related

Remove a class from HTML element

Remove class from HTML element

Use Element.classList and DOMTokenList.remove() to remove the specified class from the element.

CSS

Make a draggable element

Make a draggable element

In order to make an element draggable, we need to handle three events.

Miscellaneous

Template Literals

Template Literals

Template literals provide a simpler way to create strings that span multiple lines or contain data.

Miscellaneous

Looping over an object’s keys and values

Looping over an object’s keys and values

In this example you have access to each pair using the key and value variables during the loop.

Miscellaneous

Take a number and return it in the specified currency formatting

Take a number and returns it in the specified currency formatting

Use Intl.NumberFormat to enable country / currency sensitive formatting.

Math Related

Drag to scroll

drag to scroll

This post shows you a simple way to allow users to scroll by dragging the element with vanilla JavaScript.

Navigation

Determine if a string contains a substring

Determine if a string contains a substring

String.indexOf() returns the index of where the substring starts in the string, or -1 if the substring isn’t found.

Miscellaneous

Finding a specific object in an array of objects

Finding a specific object in an array of objects

Iterating through an array of objects to find a specific one.

Miscellaneous

  • « Go to Previous Page
  • Go to page 1
  • Interim pages omitted …
  • Go to page 12
  • Go to page 13
  • Go to page 14
  • Go to page 15
  • Go to page 16
  • Interim pages omitted …
  • Go to page 36
  • Go to Next Page »

Primary Sidebar

Popular Posts

Story Generator

IP Grabber – get a users IP address with JavaScript

Simple Calendar

Remove Ads

Astrological Calculator

Copyright © 2025 JavaScriptSource.com

  • About
  • Privacy Policy
  • FAQ
  • Jobs For Developers