1

That is when i click on a button it should fire browser's find event and browser's find pop up should appear.

user7920031
  • 21
  • 1
  • 2
  • 6
    Possible duplicate of [Use Browser Search (Ctrl+F) through a button in website?](https://stackoverflow.com/questions/8080217/use-browser-search-ctrlf-through-a-button-in-website) – frozen Jul 08 '17 at 19:17
  • Possible duplicate of [How can I programmatically trigger the search of my browser?](https://stackoverflow.com/questions/41297650/how-can-i-programmatically-trigger-the-search-of-my-browser) – JJJ Jul 08 '17 at 19:18

1 Answers1

0

You can set your button to call Javascripts window.find function. Works in Chrome and Firefox and possibly Edge.

Javascript

findString = function findText(text) {
  window.find(text);
  alert("String \x22" + text + "\x22 found? " + window.find(text));
}

HTML

<p>Apples, Bananas, and Oranges.</p>
<button type="button" onClick='findString("Apples")'>Search for Apples</button>
<button type="button" onClick='findString("Banana")'>Search for Banana</button>
<button type="button" onClick='findString("Borange")'>Search for Borange</button>

Here is a website for reference.

https://developer.mozilla.org/en-US/docs/Web/API/Window/find

  • I dont want the find to happen as given above. Just need the pop up to appear, How does the browser's find pop up appears when a user clicks Ctrl+F keys on a keyboard. Need to mimic that – user7920031 Jul 09 '17 at 08:11