I am creating a contact form, I have two inputs, of type="checkbox"; the first one is email, and is already checked, but I want to uncheck this, in the event that the user picks the "Phone" option, and show the phone input in which to enter the phone number.
Here's the code: at JS Fiddle
I hope you guys can help me, I'm still a js newbie but I have learnt a lot.
HTML Name *:
<label for="">Email <span>*</span>:</label>
<input type="email" placeholder="Email (Required)">
<label for="">Got a question? <span>*</span>:</label>
<textarea name="" id="" rows="1" placeholder="Got a question? (Required)"></textarea>
<label for="">Best form to contact</label>
<div>
<p>Email: </p>
<input type="checkbox" name="fruit" value="email" id="email2" checked>
</div>
<div>
<p>Phone: </p>
<input type="checkbox">
<input type="text" placeholder="Give us your phone" id="phonecheck" class="NoDisplayed">
</div>
<div class="SendButton">
<a href="" id="send">Send</a>
</div>
</form>
</div>
</div>
Javascript
$('#ChatContainer').hide();
$('.NoDisplayed').hide();
$('#ChatToggle').click(function(){
$('#ChatContainer').toggle('slow');
});
Thank you.