JavaScript Introduction Basic

JavaScript Introduction Basic

JavaScript Introduction:

JavaScript is the most popular programming language in the world.

Let's look at some uses of JavaScript with examples.

JavaScript has multiple methods, one of which is the getElementById () method.

Example:

  1. <html lang="en">
  2.   <head>
  3.     <meta charset="utf-8">
  4.     <title>This is JavaScript Example !</title>
  5.   </head>
  6.   <body>
  7.     <h1>This is JavaScript Example</h1>
  8.     <p id="demo">Click me</p>
  9.     <button type="button" onclick='document.getElementById("demo").innerHTML = "Hello JavaScript"' >Please Click Me!</button>
  10.   </body>
  11. </html>

 

Output:

 

JavaScript can change HTML style:

 

  1. <html lang="en">
  2.   <head>
  3.     <meta charset="utf-8">
  4.     <title>This is JavaScript Example !</title>
  5.   </head>
  6.   <body>
  7.     <h3>JavaScript Example</h3>
  8.     <p id="test">JavaScript can change HTML attributes</p>
  9.     <button type="button" onclick="document.getElementById('test').style.color='red'">Cleck Here!</button>
  10.   </body>
  11. </html>

Output:

 

JavaScript can change HTML attributes:

  1. <html lang="en">
  2.   <head>
  3.     <meta charset="utf-8">
  4.     <title>This is JavaScript Example !</title>
  5.   </head>
  6.   <body>
  7.     <h3>JavaScript Example</h3>
  8.     <button onclick="document.getElementById('test').type='text'">Password show</button><br><br>
  9.     <input id="test" type="text" value="12345678"><br><br>
  10.     
  11.     <button onclick="document.getElementById('test').type='password'">Password Hide</button>
  12.   </body>
  13. </html>

 

Output:

 

JavaScript Introduction, JavaScript Password show, JavaScript Password Hide, basic javascript, JavaScript getElementById method, JavaScript button, JavaScript onclick, javascript tutoral, learn javascript,  js, js password show and hidden, javascript to html color change, 

 

Thank You......