0
I have a field for general search and other segmented search fields (Pending, Current, Closed), I want everything typed in general to be automatically passed to the segmented ones.
I created this function that does this:
function myFunction() {
$('#listaContratos').bootstrapTable('resetSearch', $('#myInput').val());
}
Which is called when some value is typed in the general search:
<input class="form-control" id="myInput" onkeydown="myFunction()" type="text" placeholder="Pesquisar" />
However, the first time I call the function, there is still nothing in "myInput", so it always arrives in the targeted searches with a character less. Example: While overall I typed 2353, in segmented comes 235.
How do I, for when the function is called, also be passed the value I just typed?
Change the onkeydown event to onkeyup. When the onKeyDown event is called, the character has not yet been added to the input value.
– Daniel Santos
@Danielzazula that’s right, thank you!
– Newton Sandey