The jQuery splits on newline and fills the autocomplete whenever the textarea changes:
$("#Choices").change(function () { var choices = $(this).val().split('\n'); $("#DefaultChoice").autocomplete({ source: choices }); });And the supporting markup:
<div id="DivList" class="dataChoice"> <label for="Choices">Choices:</label> <textarea cols="20" id="Choices" name="Choices" rows="2"></textarea> <label for="DefaultChoice">Default Choice:</label> <input id="DefaultChoice" name="DefaultChoice" type="text" value="" /> </div>Get the full source on GitHub.
No comments:
Post a Comment