• 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
Home / Archives for Miscellaneous

Miscellaneous

Strip HTML from a given text

Strip HTML from a given text

Here are 2 ways to strip HTML code from a given text.

Miscellaneous

Remove a Character From a String in JavaScript

Remove a Character From a String in JavaScript

How can you remove a character from a string in JavaScript? Here are a few different ways to do this.

Miscellaneous

Show or hide an element

Show or hide an element

Quick tip on how to show or hide an element with JavaScript

Miscellaneous

Return the last element in an array

Return the last element in an array

Use Array.prototype.length – 1 to compute the index of the last element of the given array and return it, otherwise return undefined.

Miscellaneous

Copy text to the clipboard

Copy text to the clipboard

Assume that we want to copy a given text to the clipboard. Here’s how.

Miscellaneous

Confirm Yes or No With JavaScript

Confirm Yes or No With JavaScript

How to display a confirm dialog box using JavaScript. The confirm dialog box allows you to perform actions based on the user input.

Miscellaneous

Get all direct descendant elements that match a test

Get all direct descendant elements that match a test

To do this, we need to combine Node.children with a few other techniques.

Miscellaneous

Check if all elements in an array are equal

Check if all elements in an array are equal

Use Array.prototype.every() to check if all the elements of the array are the same as the first one.

Miscellaneous

Detect If an Element has focus

Detect If an Element has focus

To detect if an element has the focus, you use the read-only property activeElement of the document object.

Miscellaneous

Sanitize an HTML string to reduce the risk of XSS attacks

Sanitize an HTML string to reduce the risk of XSS attacks

Sanitizing is the process of removing any attributes, properties, and values that are not included in an allowlist or that are explicitly forbidden on a disallow list.

Miscellaneous

  • « Go to Previous Page
  • Go to page 1
  • Interim pages omitted …
  • Go to page 11
  • Go to page 12
  • Go to page 13
  • Go to page 14
  • Go to page 15
  • Go to page 16
  • 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