JavaScript Code Snippets

Some JavaScript functions and code snippets useful for JavaScript Programmers and JS scripts.
New JavaScript Code Snippets might be added soon.

  1. Delete multiple consecutive characters and Split long words
  2. Keep the first Nr IMG tags, Remove all the others
  3. Add Text in Canvas from Input text field, as it is Typed
  4. Clear Canvas Context
  5. Get the Height and Width of web Page and browser Window
  6. Detect when ScrollBar reaches the bottom of the page
  7. Add Tag to Selected Text in textarea with JavaScript
  8. Select the Content of HTML Element
  9. Convert BBCode to HTML and HTML to BBCode
  10. Show and Hide HTML elements
  11. Recursive function to create Multi-Level Menu in JavaScript
  12. Highlight Images on click
  13. Disable button and Enable it after specified time
  14. Get Domain Name and other Data from URL
  15. Get search data from URL address in JavaScript
  16. SHA512 Encrypt hash
  17. SHA256 Encrypt hash
  18. SHA1 Encrypt data
  19. MD5 hash string
  20. Base64 encode decode
  21. Split an alphanumeric string into Array
  22. Delete and Add CSS class
  23. Replace JavaScript variable name from string with its value
  24. Get the value of the selected /checked checkboxes in a form
  25. Get Lower, Higher and Closest Number in JavaScript
  26. Difference between two Dates - Time and Date
  27. JavaScript trim, rtrim and ltrim
  28. JS PHP is_ functions to test data type
  29. array_map and array_search in JS
  30. JavaScript strip_tags and stripslashes
  31. Zodiac Signs JavaScript code