Page 1 of 1
Get text in a search box
Posted: Fri Feb 06, 2015 7:06 am
by M&M
how do I get the text that is typed in a search component?
tried the below 3. None of them work. I get an error
code
console.log(this.text());
console.log(this.val());
console.log(this.attr('value'));
/code
None of the above work
Get text in a search box
Posted: Fri Feb 06, 2015 7:16 am
by Evgene Karachevtsev
M&M,
This should work
preAppery("mobilesearchbar_7").val()/pre
Get text in a search box
Posted: Fri Feb 06, 2015 8:49 am
by M&M
thanks. Btw I was referring to the element within one of the events. So I thought that this refers to the search component. Anyway thanks
Get text in a search box
Posted: Mon Feb 09, 2015 4:16 pm
by Evgene Karachevtsev
Hello M&M,
Sorry for delay.
Could you please clarify, is previous solution works for you? Because for different events it is better to use different ref "this" or "events" variables.
Get text in a search box
Posted: Tue Feb 10, 2015 9:12 am
by M&M
hi,
Yes it works for me. Even $(this).val() works too, in the keyup event.
Thanks,
M&M