javascript - Getting the input's text when no selection is made -


i've been stuck on trying around code hours. i've used similar code jqueryui combobox

users want able choose list, or type in own options if none in list shown.

the thing giving me trouble, when value typed in input, returns null selection, since don't match anything. on submit, value returned null.

is there way pullup value of input, rather select value?

thank you.

i check value of combobox first. if no value found (or null) check value in text input. if no value found there (both have null values) throw error nothing selected.

something this:

var value; if ( $('combobox').val() ) {      value = $('combobox').val()); } else {     if ($('textbox').val())     {        value = $('textbox').val();     }     else     {        alert('hey, gotta have value!');     } } 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -