0

I am currently working with Adobe Captivate 8 Elearning software. I have done extensive searching for answers here and abroad on many different forums and have yet to find a solution. I hope I can receive some help here.

I have been using the Execute Javascript feature within Captivate to manipulate keyboard focus and make the interactions go more smoothly. I have used the following Javascript code with great success in having keyboard focus shift to another object on screen when a button is selected.

var elem = document.getElementById('Insert_Object_Name_here');

$(elem).focus();

However, this particular code only seems to work when the elearning slide has already loaded and not when, say, I want keyboard focus on a particular slide. I have been trying different variations of the javascript focus codes offered online and changed the Execute Javascript window settings from new, parent, current, and top but have not found a solution as yet.

What additions can be added to this code to address a different slide window loading or having the focus wait 1-2 seconds before executing?

Thank you for your time.

Scott Marcus
  • 64,069
  • 6
  • 49
  • 71

1 Answers1

0

If the content you are trying to focus on isn't visible on the slide you must first navigate to the frame.

// Zero based slide that contains the item to focus
cpAPIInterface.gotoSlide(1);
$("#Insert_Object_Name_here").focus();
Daniel
  • 579
  • 2
  • 7
  • Thank you. I thought of that too. But have not been successful when utilizing an Execute Javascript command in the Upon Entry action of the slide. I think it is because upon entry, nothing in the slide is on screen. Is there a variation to your code or mine that can make the focus wait 1 or 2 seconds before executing the Javascript? Later versions of Captivate have a wait X amount of seconds action, but Captivate 8 does not. – AgentOrangeness Jun 28 '17 at 20:48