lundi 4 juillet 2016

Adding Text to Text if Condition is met

How can I in jQuery or plan Javascript add text if condition is met?

For example:

<input type="checkbox" id="foo">                
<label for="foo">Foo Text</label>                
<input type="checkbox" id="bar">                
<label for="bar">Bar Text</label>            
<p class="success" style="display: none;">Thank you for </p>        
<button type="submit" id="submit-form" class="btn btn-success pull-left">SUBSCRIBE</button>

Not I need a logic that will place a "Bar Text" or "Foot Text" depending which checkbox is checked, after the submit is clicked.

I know I have to use .is(:checked) but I do not know how to place a text dynamically after the static "Thank you " text.

Also, I would like a jQuery and Javascript solution, if possible, for learning purposes only.

Thanks.




Aucun commentaire:

Enregistrer un commentaire