The code below:
<form>
<div class="form-group">
<label for="inputEmail">Email</label>
<input type="email" class="form-control" id="inputEmail" placeholder="Email">
</div>
<div class="form-group">
<label for="inputPassword">Password</label>
<input type="password" class="form-control" id="inputPassword" placeholder="Password">
</div>
<div class="form-group">
<label class="form-check-label"><input type="checkbox"> Remember me</label>
</div>
<button type="submit" class="btn btn-primary">Sign in</button>
</form>
I know what an id
and what a class
attribute, However, I am confused about why you use both in an element?
For example the above is in bootstrap, why is this: class="form-control
with the id="inputPassword"
I would like an explanation why and when to use it because I would just use the class and not the id for this situation.