Focus on Text Field

rss

Posted by Adam Reyes - Nov 10 ’14 at 01:14

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();

}

} )

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 3 months 29 days
    #1 by Dmitry Kozlov Nov 11 ’14 at 04:32

    Hi Adam,

    Please, try the following code to set focus on the text field:

    $('.suggested-field input').focus();
  • Adam Reyes
    Adam Reyes
    Member
    Member for: 7 years 9 months 18 days
    #2 by Adam Reyes Nov 11 ’14 at 10:31

    That worked perfectly, thanks Dmitry!

  • coresoul
    Member
    Member for: 6 years 10 months 25 days
    #3 by coresoul Mar 27 ’15 at 02:44

    [#1]: how can i focus peoplepicker field?

Displaying 1 to 3 of 3 messages