How to set textbox timeout ?

How to set textbox timeout ?

Hi all,
I want to set textbox timeout.

if not complete insert data to textbox in 5 sec, textbox will empty.
if complete insert data to textbox ( insert 15 charectors ), it will use data in textbox to other function.

How did I do ?

Thank you