dongyan3853 2017-02-04 18:54
浏览 57

在文本字段中输入文本,单击按钮并在页面上获取结果(JQuery)

I am trying to make a skill for the amazon echo (with js and JQuery) but I am a little stuck. I want to enter 2 things in 2 different text fields on a website. This works. $('#Field1').val("Test Text"); $('#Field2').val("Test Text 2");

E.g. Field1: Test Text --- Field2: Test Text 2

Then I want to click a button on this Website. This doesn't work and I don't know how to do it.

After pressing the button I want to get the results that show up on the website. Getting the results (when using manual input, so clicking the button by hand) works. I hope you guys get me and can help me!

Greetings Fabian

  • 写回答

1条回答 默认 最新

  • drgweamoi473182981 2017-02-04 19:51
    关注

    It depends on the form.

    HTMLElement.click() works with input types of "button" and "submit".

    HTMLFormElement.submit() submits a form.

    jQuery also has a .trigger() method and aliases like .click() if you need to trigger specific jQuery events.

    You'll need to understand what elements and event listeners the form has and use the appropriate methods. Note that these techniques have caveats and restrictions because of browser compatibility and security risks for the user.

    评论

报告相同问题?