0

Suppose we're on a webpage that has a textbox for input with the CSS path input[type = 'input'].

I'm trying to write a script that runs on Chrome+Tampermonkey that will enter a text in this textbox and then press on the 'apply' button.

For the 'apply' button something like this will work:

function To3(){
  setTimeout(function() {
    'use strict';
     $( "button[label='apply']" ).click()
     To1();
  }, 2000);
}

How can I write a script that will enter a text in the above textbox?

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
Mariah
  • 192
  • 1
  • 1
  • 12

1 Answers1

0

I think you mean something like input[type="text"], right? Not input[type="input"].

I believe your question is how to set an input value in jQuery using a selector. If so, the answer is:

$('input[type="text"]').val(yourValue)

Check the .val() reference.

Andre Pena
  • 56,650
  • 48
  • 196
  • 243