Home » Code snippets

HTML, JavaScript, CSS, jQuery Code Snippets/ Examples

This section contains Source Code Snippets/Examples on HTML, JavaScript, CSS and jQuery. Here you will find most useful and popular source codes.

List of all JavaScript, CSS, jQuery Source Code Snippets/Examples

JavaScript (JS) Tutorial

  1. An Introduction to JavaScript (Vanilla JS)
  2. Java vs JavaScript | Differences and Popularities
  3. JavaScript Syntax
  4. Comments in JavaScript
  5. Operators in JavaScript
  6. Bitwise Operators in JavaScript
  7. typeof Operator with Example in JavaScript
  8. delete Operator with Example in JavaScript
  9. Spread Operator in JavaScript
  10. Rest Operator in JavaScript
  11. Difference between == and === operators in JavaScript
  12. Booleans in JavaScript
  13. Basic Web Application Development using JavaScript
  14. Where to place JavaScript Code?
  15. Hoisting in JavaScript
  16. How to write an HTML output in JavaScript?
  17. How to write into an HTML element in JavaScript?
  18. JavaScript Type Conversions
  19. JavaScript Variables
  20. const in JavaScript
  21. Constants in JavaScript
  22. Difference between var and let in JavaScript?
  23. 'this' keyword in JavaScript
  24. Assign decimal, octal and hexadecimal values to the variables
  25. Convert decimal to hexadecimal and vice versa
  26. Convert decimal to octal and vice versa
  27. If and Else statement in JavaScript (Vanilla)
  28. break statement with example in JavaScript
  29. continue statement with example in JavaScript
  30. Playing with Number in JavaScript
  31. Understanding Functions and Scopes in JavaScript
  32. How to invoke a function call in JavaScript?
  33. Coercion in JavaScript
  34. Loops in JavaScript
  35. Looping Examples/Programs
  36. Example of jumping statement (break, continue)
  37. maps and for...of loops in Javascript
  38. Arrays in JavaScript
  39. Objects in JavaScript
  40. Properties of Objects in JavaScript
  41. How to iterate over a JavaScript Object?
  42. How to get a key in an object by its value in JavaScript?
  43. How to get the first key name of a JavaScript Object?
  44. How to check if a key exists in a JavaScript Object?
  45. How to access an object having spaces in the object's key using JavaScript?
  46. How to check if an array includes an object in JavaScript?
  47. Convert an array to an object in JavaScript
  48. How to check if a JavaScript object is a DOM object?
  49. How to check object is an array in JavaScript?
  50. Search from Array of Objects | JavaScript
  51. How to replace element from an array in JavaScript?
  52. Arrow function in JavaScript
  53. Try Catch to avoid program freeze in JavaScript
  54. Understanding DOM with JavaScript
  55. Interactive Webpages / Event Handling in JavaScript
  56. Nested Event Handling in JavaScript (on mouse move event)
  57. Event Listener in JavaScript with HTML
  58. Web Application: A To-do List using JavaScript
  59. Local Storage using JavaScript
  60. Sorting Methods in JavaScript
  61. JavaScript Math Object (Methods and Examples)
  62. Forms in JavaScript (form validations)
  63. Errors in JavaScript
  64. Debug JavaScript Code
  65. Regular Expressions in JavaScript
  66. Modules in JavaScript
  67. Strict mode in JavaScript
  68. Polyfilling and Transpiling in JavaScript
  69. How to add a class name to an element in JavaScript?
  70. How to change the src of an element in JavaScript?
  71. How to change the class of an element in JavaScript?
  72. Importing and Exporting Modules in JavaScript
  73. Dialog Boxes in JavaScript
  74. Maps vs Objects in JavaScript
  75. How to create hash from string in JavaScript?
  76. How to remove CSS property using JavaScript?
  77. How to round Off a number upto 2 decimal places using JavaScript?
  78. How to return a value from a JS asynchronous callback function?
  79. How to compare two JavaScript array objects using JavaScript?
  80. Method to show or hide elements in HTML using display property in JavaScript
  81. Difference between != or !== operator in JavaScript
  82. JavaScript | Timer

JavaScript properties

  1. Cursor Property in JavaScript
  2. Infinity Property in JavaScript
  3. undefined property with Example in JavaScript
  4. NaN property with example in JavaScript
  5. Location protocol property in JavaScript

JavaScript Math Class

  1. Math.abs() Method with Example in JavaScript
  2. Math.pow() Method with Example in JavaScript
  3. Math.sqrt() Method with Example in JavaScript
  4. Math.cbrt() Method with Example in JavaScript
  5. Math.round() Method with Example in JavaScript
  6. Math.min() Method with Example in JavaScript
  7. Math.max() Method with Example in JavaScript
  8. Math.sign() Method with Example in JavaScript
  9. Math.trunc() Method with Example in JavaScript
  10. Math.log() Method with Example in JavaScript
  11. Math.log2() Method with Example in JavaScript
  12. Math.log10() Method with Example in JavaScript
  13. Math.exp() Method with Example in JavaScript
  14. Math.expm1() Method with Example in JavaScript
  15. Math.random() Method with Example in JavaScript
  16. Math.sin() Method with Example in JavaScript
  17. Math.sinh() Method with Example in JavaScript
  18. Math.acos() Method with Example in JavaScript
  19. Math.cos() Method with Example in JavaScript
  20. Math.cosh() Method with Example in JavaScript
  21. Math.tan() Method with Example in JavaScript
  22. Math.tanh() Method with Example in JavaScript
  23. Math.asin() Method with Example in JavaScript
  24. Math.asinh() Method with Example in JavaScript
  25. Math.acosh() Method with Example in JavaScript
  26. Math.atan() Method with Example in JavaScript
  27. Math.atanh() Method with Example in JavaScript
  28. Math.ceil() Method with Example in JavaScript
  29. Math.floor() Method with Example in JavaScript
  30. Math.atan2() Method with Example in JavaScript
  31. Math.clz32() Method with Example in JavaScript
  32. Math.imul() Method with Example in JavaScript
  33. Math.LN2 Property with Example in JavaScript
  34. Math.LN10 Property with Example in JavaScript
  35. Math.PI Property with Example in JavaScript
  36. Math.SQRT1_2 Property with Example in JavaScript
  37. Math.SQRT2 Property with Example in JavaScript
  38. Math.LOG10E Property with Example in JavaScript

JavaScript Window Class

  1. Window innerWidth and innerHeight Properties in JavaScript
  2. Redirect to a URL in JavaScript

JavaScript Object Class

  1. Object.entries() method in JavaScript

JavaScript built-in functions

  1. escape() function with example in JavaScript
  2. unescape() function with example in JavaScript
  3. fill() function with example in JavaScript
  4. includes() function with example in JavaScript
  5. encodeURI() and decodeURI() functions with example in JavaScript
  6. encodeURIComponent() and decodeURIComponent() functions with examples in JavaScript
  7. parseInt() function with example in JavaScript
  8. isNaN() function with example in JavaScript
  9. Number() function with example in JavaScript
  10. String() function with example in JavaScript
  11. eval() function with example in JavaScript
  12. focus() Method with Example in JavaScript
  13. setInterval() Method with Example in JavaScript

JavaScript String Methods

  1. String toLowerCase() Method with Example in JavaScript
  2. String toUpperCase() Method with Example in JavaScript
  3. String startsWith() Method with Example in JavaScript
  4. String endsWith() Method with Example in JavaScript
  5. String charAt() Method with Example in JavaScript
  6. String charCodeAt() Method with Example in JavaScript
  7. String fromCharCode() Method with Example in JavaScript
  8. String substr() Method with Example in JavaScript
  9. String replace() Method with Example in JavaScript
  10. String indexOf() Method with Example in JavaScript
  11. String lastIndexOf() Method with Example in JavaScript
  12. String search() Method with Example in JavaScript
  13. String concat() Method with Example in JavaScript
  14. String includes() Method with Example in JavaScript
  15. String repeat() Method with Example in JavaScript
  16. String normalize() Method with Example in JavaScript
  17. String slice() Method with Example in JavaScript
  18. String localeCompare() Method with Example in JavaScript
  19. String substring() Method with Example in JavaScript
  20. String valueOf() Method with Example in JavaScript
  21. Difference between indexOf() and search() methods in JavaScript

JavaScript Number Methods

  1. Number MAX_VALUE Property with Example in JavaScript
  2. Number MIN_VALUE Property with Example in JavaScript
  3. Number isNaN() Method with Example in JavaScript
  4. Number isFinite() Method with Example in JavaScript
  5. Number isInteger() Method with Example in JavaScript
  6. Number toString() Method with Example in JavaScript
  7. Number toExponential() Method with Example in JavaScript
  8. Number toFixed() Method with Example in JavaScript
  9. Number toPrecision() Method with Example in JavaScript

JavaScript Array Methods

  1. Array length property with example in JavaScript
  2. Array constructor property with example in JavaScript
  3. Array isArray() method with example in JavaScript
  4. Array push() method with example in JavaScript
  5. Array pop() method with example in JavaScript
  6. Array shift() method with example in JavaScript
  7. Array unshift() method with example in JavaScript
  8. Array reverse() method with example in JavaScript
  9. Array fill() method with example in JavaScript
  10. Array concat() method with example in JavaScript
  11. Array copyWithin() method with example in JavaScript
  12. Array entries() method with example in JavaScript
  13. Array every() method with example in JavaScript
  14. Array some() method with example in JavaScript
  15. Array filter() method with example in JavaScript
  16. Array find() method with example in JavaScript
  17. Array join() method with example in JavaScript
  18. Array toString() method with example in JavaScript
  19. Difference between join() and toString() Methods in JavaScript

JavaScript Date Methods

  1. Date constructor property with example in JavaScript
  2. Date getDate() method with example in JavaScript
  3. Date getDay() method with example in JavaScript
  4. Date getMonth() method with example in JavaScript
  5. Date getFullYear() method with example in JavaScript
  6. Date getHours() method with example in JavaScript
  7. Date getMinutes() method with example in JavaScript
  8. Date getSeconds() method with example in JavaScript
  9. Date getMilliseconds() method with example in JavaScript
  10. Date getTime() method with example in JavaScript
  11. Get current time in Hours24: Minutes: Seconds format in JavaScript
  12. Get current Date in Date / Month / Year format in JavaScript
  13. Date getTimezoneOffset() method with example in JavaScript
  14. Date getUTCDate() method with example in JavaScript
  15. Date getUTCDay() method with example in JavaScript
  16. Date getUTCMonth() method with example in JavaScript
  17. Date getUTCFullYear() method with example in JavaScript
  18. Date getUTCHours() method with example in JavaScript
  19. Date getUTCMinutes() method with example in JavaScript
  20. Date getUTCSeconds() method with example in JavaScript
  21. Date getUTCMilliseconds() method with example in JavaScript
  22. Get current UTC time in Hours24: Minutes: Seconds format in JavaScript
  23. Get current UTC Date in Date / Month / Year format in JavaScript
  24. now() method with example in JavaScript
  25. Date parse() method with example in JavaScript
  26. Date setDate() method with example in JavaScript
  27. Date setMonth() method with example in JavaScript
  28. Date setFullYear() method with example in JavaScript
  29. Date setHours() method with example in JavaScript
  30. Date setMinutes() method with example in JavaScript
  31. Date setSeconds() method with example in JavaScript

JavaScript (JS) Codes/Examples

  1. Input value from the user using prompt
  2. Example of if with else
  3. Example of if else if
  4. Example of Nested if
  5. Find largest of three numbers using Nested if in JavaScript
  6. Example of Ternary Operator
  7. Image Recognition Game using JavaScript
  8. Code to input age and check person is eligible for voting or not
  9. Function with default value
  10. Function call example with given number of arguments and less arguments
  11. Demonstrate the example of call by value in function
  12. Some of the examples of user-defined functions
  13. Common properties and methods of Array
  14. Code to declare an array and assign the elements using array indexing
  15. Code to declare an array and print using for each loop
  16. Code to declare an array and print using for loop
  17. Password strength checker in JavaScript
  18. Print characters of a string in multiples of N in JavaScript.
  19. How to check whether a string contains a substring in JavaScript?
  20. How to break in nested loops in JavaScript?
  21. Understanding callbacks in JavaScript.
  22. How to create accordions with JavaScript?
  23. JavaScript code to check number is Perfect or not.
  24. JavaScript code to check number is Armstrong or not.
  25. JavaScript code to check whether a Number is Prime or Not.
  26. JavaScript code to find largest of three numbers.
  27. Check number is palindrome or not in JavaScript.
  28. Form validation using JavaScript.
  29. JavaScript code to design calculator.
  30. Disable right click on webpage with JavaScript.
  31. How to make the font bold using JavaScript?
  32. Return multiple elements from function in JavaScript.
  33. How to get URL parameters using JavaScript?
  34. How to copy text to clipboard with JavaScript?
  35. How to get days of current month in JavaScript?
  36. Get browser details through JavaScript.
  37. Calculate the average of arguments in JavaScript.
  38. Ways to access object property in JavaScript.
  39. Count occurrence of a particular character in a string in JavaScript.
  40. Creating a property on prototype in JavaScript.
  41. Create a student object and print the details in JavaScript.
  42. Create a forward and back buttons in JavaScript.
  43. Different ways to create an Object in JavaScript.
  44. How to allow only alphabets in input field in JavaScript?
  45. Get the size of a file with JavaScript.
  46. How to get the decimal part of a floating number in JavaScript?
  47. Get current date, month and year in JavaScript.
  48. How to parse number from string in JavaScript?
  49. How to find absolute value of a number in JavaScript?
  50. Create functions with default arguments in JavaScript.
  51. How to return object from function in JavaScript?
  52. Get index of an element in JavaScript.
  53. Print a fibonacci series in JavaScript.
  54. Find the larger of two numbers in JavaScript.
  55. Convert a number into different base in JavaScript.
  56. Find substring within a string in JavaScript.
  57. Count the number of arguments passed to function in JavaScript.
  58. Ways to create Date object in JavaScript.
  59. Check if number is a valid number in JavaScript.
  60. Determine the largest element in the array in JavaScript.
  61. Addition of two numbers using JavaScript.
  62. Create a user defined array in JavaScript.
  63. Concatenation operator in JavaScript.
  64. New variable declaration keywords in JavaScript.
  65. Dynamically add CSS class with JavaScript.
  66. Reverse an array in JavaScript.
  67. Access global variables inside function in JavaScript.
  68. How to fill dropdowns using JavaScript?
  69. Create a string parser with symbols for actions in JavaScript.
  70. Join elements of an array in JavaScript.
  71. JavaScript multiply every array element with a constant.
  72. JavaScript check if an array element is empty.
  73. Different ways to display output in JavaScript.
  74. Check if an element is present in an Array in JavaScript?
  75. How to change the font-size with JavaScript?
  76. JavaScript Reverse print an array.
  77. Template literals in JavaScript.
  78. How to get the extension of a file using JavaScript?
  79. The JavaScript forEach method in detail.
  80. Generate random number within a range in JavaScript.
  81. JavaScript program to create an object from a function.
  82. JavaScript program to split the keywords in the string.
  83. JavaScript program to check if the variable is a valid string variable.
  84. JavaScript Program to print sum of range with steps.
  85. JavaScript Program to create a power function and print the result.
  86. JavaScript to detect whether page is load on Mobile or Desktop.
  87. JavaScript - Select/Unselect (Check/Uncheck) all CheckBoxes on Button Click.
  88. JavaScript - Allow only numbers in TextBox (Restrict Alphabets and Special Characters).
  89. JavaScript - Redirect to another URL on Button Click.
  90. JavaScript - Display Input Text into Lowercase.
  91. JavaScript - Display Input Text into Uppercase.
  92. JavaScript - Display current Date and Time.
  93. Check selected Radio Button value using JavaScript.
  94. JavaScript function to add two integer numbers.
  95. Show/Hide Div on Button Click using JavaScript.
  96. Display different Alert Message on different Button Click Event using JavaScript.
  97. Display Alert Message on Button Click Event using JavaScript.
  98. JavaScript - Select/Unselect (Check/Uncheck) all CheckBoxes on Button Click.
  99. JavaScript - Print value of all checked (selected) CheckBoxes on Button click.
  100. JavaScript - Print Selected Item from SelectBox.
  101. JavaScript - Add user entered item into ListBox.
  102. JavaScript - Required Field Validator for TextBox on Submit.
  103. JavaScript - Move Object with Arrow Keys using JavaScript Function.
  104. JavaScript - Set Focus on Particular Field in a Form using JavaScript Function.
  105. JavaScript - Set Customize Text in Browser Status Bar using JavaScript Function.
  106. JavaScript - Detect and Display Screen Resolution using JavaScript Function.
  107. JavaScript - Function to Refresh Page on Button Click.
  108. JavaScript - Disable Button after Click using JavaScript Function.
  109. JavaScript - Disable Button after Click using JavaScript Function.
  110. JavaScript - Close Current Tab on Button Click with Confirmation.
  111. JavaScript - Show/Hide Paragraph Text inside Div on Button Click.
  112. Simple Web Dictionary | JavaScript Switch Statement Project
  113. Data Unit Conversion Tool in JavaScript
  114. Age calculator Web Application | Integrating JavaScript function with form
  115. Lowercase to Uppercase Converter JavaScript Tool | Web App Project
  116. Sample report card web application prototype using JavaScript
  117. JavaScript | Create an object and display its values in a table
  118. JavaScript | Create an object and display its content in a table through JavaScript function
  119. JavaScript | Create an object by passing values in the function and display in the table
  120. Capitalize words in a string in JavaScript
  121. How to get multiple random unique elements from an array in JavaScript?



Cascading styles sheet (CSS)

  1. Top CSS frameworks for elegant design
  2. CSS Preprocessor
  3. CSS Combinators
  4. Variables in CSS
  5. Colors in CSS
  6. Measurement Units in CSS
  7. Height and Width in CSS
  8. Padding in CSS
  9. Text Formatting in CSS
  10. Borders in CSS
  11. Changing font in CSS
  12. Margins in CSS
  13. Outlining the content in CSS
  14. Selectors in CSS
  15. The '+' (plus sign) CSS selector
  16. Styling Links in CSS
  17. display Property in CSS
  18. overflow Property in CSS
  19. opacity property in CSS
  20. max-width property in CSS
  21. transitions Property using CSS
  22. Positioning elements (The position property) in CSS
  23. The border-radius Property in CSS
  24. clear Property in CSS
  25. Border Images in CSS
  26. Counters in CSS
  27. Multiple columns in CSS
  28. Rounded Corners in CSS
  29. Styling Lists in CSS
  30. How to create an Unordered List without using Bullets using CSS in HTML?
  31. Pseudo Classes | CSS
  32. CSS Box Sizing
  33. How to change link color on hover in CSS?
  34. Style alternate rows of a table with CSS
  35. Change the perspective of an element in CSS
  36. Use custom fonts to webpage with CSS
  37. Flip an image element using CSS
  38. How to set perfect image background with CSS?
  39. Overlap one element over another with CSS
  40. Change image shapes with CSS
  41. Show captions on image hover using CSS
  42. Creating Gradients with CSS3
  43. Vertically center any element in CSS
  44. Rotate fix an image on page with CSS
  45. How to make background image fit on screen using CSS?
  46. How to scale a picture size in CSS?
  47. How to make a div centre align using CSS?
  48. Center any element horizontally in CSS
  49. Styling input placeholder with CSS
  50. Make a drop-cap effect using CSS
  51. Creating a loading animation with CSS
  52. Custom Radio Button Styling with CSS
  53. Basic Shapes in CSS
  54. CSS - Apply Different Style (Color, Background Color) on Even and Odd Table Columns (td)
  55. CSS - Apply Different Style (Color, Background Color) on Even and Odd Table Rows
  56. CSS - Make Two DIVs Left and Right Aligned inside Main DIV
  57. CSS - Make Inner DIV center inside Outer DIV
  58. CSS - Create and Apply CSS for All Buttons on the Page
  59. Navigation Bar using CSS
  60. Creating dropdown in CSS
  61. Web Fonts using CSS
  62. Media Queries in CSS
  63. CSS Grid Container
  64. 2D Transformation using CSS
  65. CSS Text Effects | How to add effects to text using CSS?
  66. CSS Shadow Effects
  67. The scroll-behavior Property in CSS
  68. The pointer-events Property in CSS
  69. The backface-visibility Property in CSS
  70. The caption-side Property in CSS
  71. The object-fit Property in CSS
  72. The order Property in CSS
  73. The quotes Property in CSS
  74. The resize Property in CSS
  75. The user-select Property in CSS
  76. The word-break Property in CSS
  77. Transition shorthand in CSS
  78. Styling Dropdown in CSS
  79. Styling Checkbox using CSS
  80. Adjusting space between two rows in a table using CSS
  81. Aligning element to the bottom of the div using CSS
  82. Disable text selection highlighting using CSS
  83. Disabling a link using CSS
  84. How to clear floats (clearfix) using CSS?
  85. How to blur an image using CSS?
  86. How to set background image size using CSS?
  87. How to perform 3D transformation using CSS?
  88. Overlay one div over another div using CSS
  89. How to display XML using CSS?
  90. How to hide scroll bar while scrolling using CSS?
  91. How to prevent line breaks in the list of items using CSS?
  92. How to remove iframe borders using CSS?
  93. Creating Tooltips using CSS
  94. Difference between values of word-break 'break-all' versus 'break-word' in CSS
  95. How to create a vertically scrollable div using CSS?
  96. How to hide element at the time of printing using CSS?
  97. Rescale font based on container width in CSS
  98. Set cellpadding and cellspacing in CSS
  99. Set Divs not larger than its contents using CSS
  100. How to Set height of div to 100% height of window using CSS?
  101. Set the opacity only to background color and not on text using CSS
  102. Using a not:first-child selector in CSS
  103. Wildcard Selectors (*, ^ and $) in CSS
  104. How to convert px into em in CSS?
  105. How to remove the space between inline-block elements?
  106. How to create and use CSS triangle?
  107. How to horizontally center a DIV using CSS?
  108. How to set the background of a text or an image as transparent using CSS?
  109. How to set the sticky footer at the bottom of a webpage using CSS?

CSS functions

  1. calc() Function with Example in CSS
  2. hsl() Function with Example in CSS
  3. hsla() Function with Example in CSS
  4. rgb() Function with Example in CSS
  5. rgba() Function with Example in CSS
  6. linear-gradient() Function with Example in CSS
  7. radial-gradient() Function with Example in CSS
  8. repeating-linear-gradient() Function with Example in CSS
  9. repeating-radial-gradient() Function with Example in CSS
  10. cubic-bezier() Function with Example in CSS










Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.