Reputation: 19
There is a texbox on a Fb groups. This is the html code:
<input type="text" class="inputtext textInput" name="freeform"
placeholder="Gruba Başkalarını Ekle" autocomplete="off" aria-autocomplete="list"
aria-expanded="false" aria-owns="typeahead_list_u_jsonp_4_2" aria-haspopup="true"
role="combobox" spellcheck="false" aria-label="Gruba Başkalarını Ekle"
id="u_jsonp_4_3">
And I input a name by using javascript code.
document.getElementsByName('freeform')[0].value = '" + textBox2.Text + "';
But there is no button to click and I am using SendKeys.Send("{ENTER}")
event to click enter.
The problem is that SendKeys.Send
is not enough for me and I wanna press enter key by using another ways.
How can I hit enter key without using SendKeys.Send
?
Upvotes: 0
Views: 2122
Reputation: 337714
You can achieve this in jQuery quite easily by creating an event and assigning the keyCode of the enter key, which is 13
:
var e = jQuery.Event('keydown');
e.which = 13;
$('input[name="freeform"]').trigger(e);
Upvotes: 2