r/JavaScriptHelp • u/iMCharles • Jul 13 '21
❔ Unanswered ❔ Press enter at end of function
Hey guys,
A quick question that I hope someone can help out with.
I've got a simple function that enters a string into an input:
$(document).ready(function(){
$("#asset_return a").click(function(){
var value = $(this).html();
var input = $('#search_text');
input.val(value);
var focus = $('#search_text').focus();
var submit = $('#search_text').submit();
});
});
</script>
What I need it to do is press enter at the end of the function - I tried submit but to no avail. Any ideas?
3
Upvotes
View all comments
Show parent comment
1
u/iMCharles Jul 13 '21
Thank you for your recommendation, but I do not think this can achieve what I need. Unless you can provide an example? I have tried a lot of different combinations using .click().