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