top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to set focus for text box in javascript?

+2 votes
424 views
How to set focus for text box in javascript?
posted Apr 2, 2018 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

you can use this function:

function setFocusToTextBox()
{
document.getElementById("mytext").focus();
}

answer Apr 3, 2018 by Binu Mon
Similar Questions
0 votes

Write validation functions and modify the onSubmit event Handler in the form code to validate the following form fields:

  1. Phone Number
    • Must be entered
    • Must be below format
    XXX-XXX-XXXX
    XXX.XXX.XXXX
    XXX XXX XXXX
+1 vote

Write a function which can take a random JSON and transform the data into multiple line human readable title value pairs.

For example:

Given JSON

{
        university: 'Oxford',
        batch: '2019-2020',
        address: {
            street: '144 Main',
            city: 'London',
            country: 'UK',
            contact: {
                fax: 'XXXXXX',
                phone: 'YYYYY'
            }
        },
        students: [{
            name: 'Jon Doe',
            age: '22'
        },{
            name: 'Mike Wilson',
            age: '32'
        },{
            name: 'David',
            age: '28'
        }]
}

Output:

university: Oxford
batch: 2019-2020
address street: 144 Main
address city: London
address country: UK
address contact fax: XXXXXX
address contact phone: YYYYY
students 1 name: Jon Doe
students 1 age: 22
students 2 name: Mike Wilson
students 2 age: 32
students 3 name: David
students 3 name: 28
...