# Tags and Search

**URL:** <https://forums.realmacsoftware.com/t/tags-and-search/57075>\
**Category:** Elements CMS\
**Created:** [July 21, 2026, 4:35pm UTC](https://forums.realmacsoftware.com/t/tags-and-search/57075 "2026-07-21T16:35:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichaelDroste](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/michaeldroste/32/37212_2.png) [@MichaelDroste](https://forums.realmacsoftware.com/u/MichaelDroste)\
**Post date:** [July 21, 2026, 4:35pm UTC](https://forums.realmacsoftware.com/t/tags-and-search/57075/1 "2026-07-21T16:35:13Z")

</div>

Would like to make the table input data into the search and bring back results…

So a user would click on ‘Blues’ in the table and search would return those songs

I’m an experimenter - and I try a gazillion ways - until something works…

I made a tags page and tags markdown files - but don’t know how to use them

tried plain text: {{item.url}} {{item.tags=“blues”}}

I think this would work if code is ok or some variation of this idea?

Thanx  
-Michael

 ![Screenshot 2026-07-21 at 11.20.04 AM](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/3/2/320edceb727976e27d737ce1e20bf36b6ce85d10.webp)  
 ![Screenshot 2026-07-21 at 11.20.32 AM](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/1/a/1a5ca5451613d7cf556fd481970f42bd35a6ff51.png)  
 ![Screenshot 2026-07-21 at 11.25.57 AM](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/6/e/6e4d8b337bc5b314c1e51aef16b83e52760b6845.png)

---

<div class="post-metadata">

**Author:** ![MichaelDroste](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/michaeldroste/32/37212_2.png) [@MichaelDroste](https://forums.realmacsoftware.com/u/MichaelDroste)\
**Post date:** [July 21, 2026, 4:44pm UTC](https://forums.realmacsoftware.com/t/tags-and-search/57075/2 "2026-07-21T16:44:07Z")

</div>

Your search box and the `{{item.tags}} {{item.title}}` loop underneath it are Elements CMS’s **Collection Search** component, which is Alpine.js‑powered under the hood. The cleanest way to wire your genre grid into it — so a click fills the search and repopulates that same results loop, right there on the page — is:

**1. Give the search field a fixed ID**  
Select the search input → inspector → **Advanced** tab → set a Custom ID, e.g. `genre-search`. (Every built‑in Elements component has this Advanced/ID section — it’s the same place Anchor links pull their IDs from.)

**2. Turn each genre cell into a real link**  
Select the “Blues” cell → inspector → **Link** panel → **Choose Link…** → set the link type to **Plain** → enter `#` as the value. This makes it a clickable `<a>` without navigating anywhere (Elements’ Link panel works on “most components and inline text areas,” so your table cells qualify).

**3. Add an `onclick` custom attribute**  
Still in that Link panel, add a Custom Attribute:

- Name: `onclick`
- Value:

js

```auto
const el = document.getElementById('genre-search'); el.value='Blues'; el.dispatchEvent(new Event('input',{bubbles:true})); return false;

```

Tried this - doesn’t work

Terms wrong? #? wrong?

 ![Screenshot 2026-07-21 at 11.41.06 AM](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/f/9/f907ed2a839c4cf35dda96852b09d2a0ff9b2f62.jpeg)

---

<div class="post-metadata">

**Author:** ![MichaelDroste](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/michaeldroste/32/37212_2.png) [@MichaelDroste](https://forums.realmacsoftware.com/u/MichaelDroste)\
**Post date:** [July 21, 2026, 5:01pm UTC](https://forums.realmacsoftware.com/t/tags-and-search/57075/3 "2026-07-21T17:01:38Z")

</div>

Well - got it working!!! Here is the code for anyone else:  
…  
document.getElementById(‘genre-search’).querySelector(‘input’).value=‘Blues’; document.getElementById(‘genre-search’).querySelector(‘input’).dispatchEvent(new Event(‘input’,{bubbles:true}))  
…

 ![Screenshot 2026-07-21 at 11.58.21 AM](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/3/1/3137f608c6352ab1630c0b65208942a5eca42dd9.jpeg)

Very cool - click on ‘Blues’ shows all the blues songs now
