FOR ATTRIBUTE IN FORMS IN HTML

Basic Intro of Forms:

Generally, forms are used to get an information from user like Name, Password, gmail, DOB etc...

Drawbacks:

  • At sometimes we can't assure that our website working properly due to some issues .
  • Some reasons like some create a Page for 1080p width screen the output is perfect. 
  • When he the same page runs in a mobile or tablet .The response of the page does not work properly  .
  • Content get collapse .
  • If it is happen in forms the user may not understand where to type username .

 Recovery:

  • For attribute is the rescuer.
  • To identify the actual field in our page .

For :

  • Use Label Tag .
  • On the time of using FOR attribute ,you want to add necessarily I'd attribute in input tag.

Example:

<label for="username">Username</label>

 <input type="text" id="username">

 This makes while touching Label it denotes the actual field . Wherever it is . It denotes definitely .

Before using for attribute:


<p>Username</p>
<input type="text">
<p>password</p>
<input type="password">
<p>DOB</label>
<input type="date">

From the above code there is no for attribute in label tag.while clicking mouse on the label it will not show the input field.Below video demonstrate this 


Form with for attribute:

 
<label for="username">Username</label>
  <input type="textid="username"><br>
  <label for="password">password</label>
  <input type="passwordid="password"><br>
  <label for="dob">DOB</label>
<input type="dateid="dob">

Now we used the for attribute in label tag .On the time clicking the name the input field starts to blink.

Example:

<label for="username">Username</label><br>
<label for="password">password</label><br>
<input type="passwordid="password"><br>
<label for="dob">DOB</label><br>
<input type="dateid="dob"><br><br>
<input type="textid="username">


In this code I , move first input tag with id="username" from first line to last line .You can think after running the output there is a label without field . And clicking on the label it shows the field wherever it is.Video to demonstrate properly.Note the point it can denote wherever it is.


Post a Comment

Post a Comment (0)

Previous Post Next Post