Search code examples
dalekjs

Clear field and type in DalekJS


I'm relatively new to DalekJS and I've been battling with clearing a field, and then typing. The .type() seems to only add to an existing string in an input box, is there any way to clear the field before typing?


Solution

  • I thought I´d implemented this some time ago, but reading my own source code made it clear to me that this isn't the case.

    As long as the clear() method is not implemented, you can use this function as a workaround:

    .execute(function () {
      document.getElementById('id-of-the-element').value = '';
    })
    

    That should do the trick.