Using views I made a search page and by using the exposed search filter as block I created my search ability on my website.

But I need to change the id of my search field. I know I can change to field by change the views filter. But for some reason edit- is added to the id. So if I change the id to my-search on the website it is changed to edit-my-search.

So I thought about changing it in the template but this specific search input field doesn't have its own template. So I can't use {{ attributes.setAttribute('id', 'myID') }} to change the id in the template.

So my question, is how can I change the id? Is there a way to create a template for this search field or is there a way to remove the edit- in front of the search field?

Any push in the right direction is welcome. Thanks

| improve this question | | | | |
  • "this specific search input field doesn't have its own template." You can give it its own template. Enable twig debugging to see theme hook suggestions, you may already see a specific template suggestion you can use (sorry, don't have a site open at the moment to check what the defaults are), if not you can implement hook_theme_suggestions_HOOK_alter. PS changing this id might break ajax – stevekeiretsu Mar 2 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.