M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

Get text in a search box

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Get text in a search box

M&M,

This should work
preAppery("mobilesearchbar_7").val()/pre

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

Get text in a search box

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Get text in a search box

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.

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

Get text in a search box

hi,

Yes it works for me. Even $(this).val() works too, in the keyup event.

Thanks,
M&M

Return to “Issues”