Altjen B. Altjen B. - 21 days ago 6
Javascript Question

how can I use focus function and calling a javascript function in asp.net?

I call a function when press the textbox. this is the code for that

onclick="GetColorBack()"


but only when click on the textbox. but if I move with TAB it wont call GetColorBack function.

how can I do that?

PS: not the CSS focus type

Answer

For "vanilla"-javascript use onclick="GetColorBack()" onfocus="GetColorBack()"

I think onfocus="GetColorBack()" will be enough, cause clicking lead to focus-event

Comments