To generate textbox dynamically I getting dynamically textbox, but focusout is not working for dynamically generated textbox, whereas same page has some textbox, which is hard-coded for that, above script gets triggered. Answer Instead of using document you could use the text box’s closest parent id or class. I have no idea of your html layout, hence using document. Also