javascript - JQuery UI Combobox - Allow any valid value apart from the populated ones -
i displaying years 2000,2001,2002 in jquery ui combobox.
my requirement allow user input manually valid year.
the jquery ui combobox seems reject values out of populated year range.
$(document).ready(function(){ $('.combobox').combobox() .addclass('overflow'); }); function checkvalidyearofconstructions() { $(".custom-combobox-input").keydown(function(event) { // allow delete, backspace,left arrow,right arrow, tab , numbers if (!((event.keycode == 46 || event.keycode == 8 || event.keycode == 37 || event.keycode == 39 || event.keycode == 9) || $(this).val().length < 4 && ((event.keycode >= 48 && event.keycode <= 57) || (event.keycode >= 96 && event.keycode <= 105)))) { // stop event event.preventdefault(); return false; } }); } $(document).ready(function() { checkvalidyearofconstructions(); }); <sf:select class="form-control combobox" path="constructionyear" items="${contructionyearlist}" disabled='<%= flag %>'/>
can me on ?
thanks in advance
siby mathew
Comments
Post a Comment