samedi 5 juillet 2014

jQuery: multiselect click event doesn't respond to click


Vote count:

0




I have a multiselect box that contains a list of image urls. I am trying to enable a click event on the multiselect box: when a user clicks on a url, it should pass the url to a textarea with the id of "articleFullText". Below is my jquery code, however, it doesn't work and does not cause any error on JS console:



$('.multiselect').click(function() {
var src = $(this).val();
$('#articleFullText').val($('articleFullText').val() + src);
});


My selectbox html:



<div class="controls">
<select name="images" class="multiselect" multiple="multiple">

<option value="http://localhost/images/1.jpg">http://localhost/images/1.jpg</option>
<option value="http://localhost/images/2.jpg">http://localhost/images/2.jpg</option>

</select>
</div>


textarea code:



<textarea class="form-control" rows="3" name="articleFullText" id="articleFullText></textarea>


asked 49 secs ago

TonyGW

486





Aucun commentaire:

Enregistrer un commentaire