Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 139953

How to add enter?

$
0
0

Hey so right now i have the code below that functions as a Ctrl+F search but within a search box. The website im using this on only have one code area so i need the code to function within the same one.

The code below does what i want it to do but at this moment we need to click on the search button the first time and then we can follow up with enter after that. What i want it to do is make it possible to accept the enter key from the start and at the same time have the button as an option.

Is this possible?

<!--BEGIN SEARCH BOX -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script> 
<div class="search_box">
<div><input id="search" type="textarea" /> <input id="submit_form" onclick="checkInput()" type="button" value="Sök" /></div>

<div>&nbsp;</div>

<div>
<p>2019-11-11 - 2020-01-10 - Testing line 837<br />
<a href="">PDF</a></p>

<p>2019-11-04 - 2019-11-24 - Testing 2, line 607, 627, 697<br />
<a href="">PDF</a></p>

<p>2019-10-30 - 2019-11-29 - Testing 3, line 55, 75, 291<br />
<a href="">PDF</a></p>

<p>2019-10-31 - 2019-11-04 - Testing 4, line 423,424<br />
<a href="">PDF</a></p>
</div>
</div>
<!--END SEARCH BOX --><script>
    function checkInput() {
        var query = document.getElementById('search').value;
        window.find(query);
        return true;
    }                           
</script>

Viewing all articles
Browse latest Browse all 139953

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>