When the end user clicks on the checkbox with id vehicle3 then I want First Name and Last Name input box to be required. The required message needs to be displayed right underneath the text box in red color. I am looking for client side coding like JavaScript or jQuery for this. I have several other checkboxes and textboxes on my web page that are not shown above.
I have the following code on my web page:
<input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname">
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname">
<label for="mname">Middle name:</label>
<input type="text" id="mname" name="mname">
<label for="class">class</label>
<input type="text" id="class" name="class">
<input style="float: right; margin-bottom:20px" type="submit" id="myBtn1" value="Submit" class="btn btn-primary" />
any help will be appreciated.