samedi 9 juillet 2016

How to change text based on option selected?


This is probably simple but I can't work it out.

I want to be able to change some paragraph text based on which option is selected.

HTML

<form action="">
<select name="" id="">
  <option id="1" value="One">One</option>
  <option id="2" value="Two">Two</option>
  <option id="3" value="Three">Three</option>
</select>
</form>
<br />
<p>Text</p>

JQ

$("#1").click(function(){
$("p").html("Changed!");
});

Here's the pen:

https://codepen.io/anon/pen/qNawgv


Aucun commentaire:

Enregistrer un commentaire