In-page text search

I want to add a text search window in the page listed separately from the browser search, is there a way? , This is a search within the page, not a search within the site

Using the Window.find() method would do that for you:
Kapture 2022-06-24 at 09.20.36

Cool, How do you use that in Blocs?

Should I look here?

I can’t read that language. LOL

This example doesn’t make sense.
HTML

Apples, Bananas, and Oranges.

Search for Apples Search for Bananas Search for Orange

[HTML](https://developer.mozilla.org/ja/docs/Web/API/Window/find#html)
<p>Apples, Bananas, and Oranges.</p>
<button type="button" onClick='findString("Apples")'>Search for Apples</button>
<button type="button" onClick='findString("Bananas")'>Search for Bananas</button>
<button type="button" onClick='findString("Orange")'>Search for Orange</button>

<p id="output"></p>
``

Should I look here?

ok thanks.
i’ll try it.:grin:

After all it was difficult for me to understand, thank you.:sob:

I added to a DIV container, a textfield and a button. Give both an ID #searchtxt and #searchbtn.
To add a placeholder to the text field add the following custom attribute:
Name= Placeholder
Value= “my fancy text”.

Set the button interaction to none and add the following custom attribute to the button:
Name= onclick
Value= “doSearch(document.getElementById(‘searchtxt’).value)”

Add to the page header:

<script>
 	function doSearch(text) {
		if (window.find(text)) {
		console.log(window.find(text));
        }
    }
</script>

And you are good to go!

3 Likes

I wrote the following in the header.

I wrote the following in the code widget.

image

But I couldn’t understand any more, I’m sorry.

If you follow my instructions you will end up with a working page search without Apples, Bananas and Oranges. Fruit salad I will have for breakfast :grin:

It’s difficult for me, but I just wanted to search for the characters on the page … I thought it would be easier :relaxed:

q-and-a.html.zip (23.2 KB)

I also feel the limits of Google Translate.

We are now, thanks to you. I appreciate you puttting this together.

With pleasure @KBConcepts. Thanks to share with us the website when you have used it.

Wow, I think I completely misunderstood. I thought this was for when I am looking for text while working in Blocs. Like Command F. Now I understand, this is for someone on a website.

I wanted to set up a text field for people who do not know the command + F function so that they can search by keyword, which is a function for people who are not familiar with personal computers.

Or you invest 30 bucks and get the Search Bric from blocs.store :wink:

That would actually be cool. However, the search bric will not give ‘same page’ results and searches for keywords.

Thank you for understanding