Focus on Text Field

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
Adam Reyes
Posts: 35
Joined: Tue Mar 04, 2014

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

}

} )

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

11 Nov 2014

Hi Adam,

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

Code: Select all

$('.suggested-field input').focus();

User avatar
Adam Reyes
Posts: 35
Joined: Tue Mar 04, 2014

11 Nov 2014

That worked perfectly, thanks Dmitry!

coresoul
Posts: 23
Joined: Tue Feb 24, 2015

27 Mar 2015

how can i focus peoplepicker field?

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests