Focus on Text Field
- Adam Reyes
- Posts: 35
- Joined: Tue Mar 04, 2014
I'm trying to set a field to show when a drop down choice is selected and then focus on that text field once it is showing but I'm trouble getting the code to function properly. Perhaps there's another way of doing? Here's the code I'm using right now:
$('.suggested-field').hide();
fd.field('CSR_x0020_Incident_x0020_Categor').control().change(function()
{
var issue = fd.field('CSR_x0020_Incident_x0020_Categor').value();
if(issue=='Other')
{
$('.suggested-field').show();
$('.suggested-field').focus();
alert('Please type in a category you would suggest if you could not find an existing one.');
}
else
{
$('.suggested-field').hide();
}
} )
$('.suggested-field').hide();
fd.field('CSR_x0020_Incident_x0020_Categor').control().change(function()
{
var issue = fd.field('CSR_x0020_Incident_x0020_Categor').value();
if(issue=='Other')
{
$('.suggested-field').show();
$('.suggested-field').focus();
alert('Please type in a category you would suggest if you could not find an existing one.');
}
else
{
$('.suggested-field').hide();
}
} )
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi Adam,
Please, try the following code to set focus on the text field:
Please, try the following code to set focus on the text field:
Code: Select all
$('.suggested-field input').focus();
-
- Information
-
Who is online
Users browsing this forum: No registered users and 10 guests