I want to add code into a div when a particular option from a select is selected.
This is the code, and I don't know why is not working.
<select id="selectbasic ref" name="selectbasic ix-select-how" class="input-xlarge">
<option value="" label=""></option>
<option value="SearchEngine" label="Suchmaschine">Suchmaschine</option>
<option value="Webhostlist" label="Webhostlist">Webhostlist</option>
<option value="Press" label="Presse">Presse</option>
<option value="Friend" label="Bekannte">Bekannte</option>
<option value="ByChance" label="Zufällig">Zufällig</option>
<option value="Others" label="Sonstige">Sonstige</option>
</select>
<div class="control-group ix-hidden"></div>
And the jQuery:
$('#ref').change(function () {
if ($(this).val() === 'Others') {
$("div.control-group.ix-hidden").append("<label class='control-label'>Wie?</label><div class='controls'><div class='input-prepend'><span class='add-on'><i class='icon-globe'></i></span><input type='text' class='input-xlarge' id='email' name='email' placeholder='Wie?'></div></div>");
}
});