set focus to textbox on blur validation...I am doing character strength validation on the blur event of textbox..How to set focus to it...

Recommended Answers

Without your code, not sure, but I would start by suggesting using the focus method.

 document.getElementById('elementID').focus()
Jump to Post

All 3 Replies

Without your code, not sure, but I would start by suggesting using the focus method.

 document.getElementById('elementID').focus()

Yup, the focus() function sets the focus to the target element :). For documentation, click here.

jQuery can do that for you too ...

$(document).ready(function() {
   $('#txtBoxId').focus();
 });
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.