Change default text in search box with custom HTML?


I am using Confluence 4.3.3. I am using the Documentation Theme. When editing a page, I see "Search Confluence". I want to override that.

I inserted this custom HTML block into the "At end of BODY" section in "Administration > Look and Feel > Custom HTML" section, but it failed when trying to save.

<script type="text/javascript">
AJS.toInit(function ($) {
        var search = jQuery(".quick-search-query");
        search.each(function() {
            searchBox = jQuery(this);
  "quicksearch", {
                placeholder: "Search me",
                placeholded: true

Specifically, a browser error reported from URL "<base url>/admin/doeditcustomhtml.action" that "the connection was reset while the page was loading".

What am I missing?

Or do I need to do this with a user macro e.g. {my_searchbox_text} and call {my_searchbox_text} in the "AT end of BODY" section in the "Custom HTML" view?

PS. My problem is exactly as reported in like but seems like I can only answer it, not ask;-)


- lisa

2 answers

1 accepted

Thank you, Daniel!


Use below code,

<script type="text/javascript">
var defaultText = "Sitede ara…";
var searchBox = document.getElementById("ctl00_ctl34_S52EF3DAB_InputKeywords");

//default text after load
searchBox.value = defaultText;

//on focus behaviour
searchBox.onfocus = function () {
if (this.value == defaultText) {//clear text field
this.value = '';

Suggest an answer

Log in or Join to answer
Community showcase
Alexey Matveev
Published Saturday in Jira

How to run Jira in a docker container

Everything below is tested on Ubuntu 17.10. I prefer to use Jira in a docker container because: 1. I can install Jira with a couple of commands. 2. I can start and stop Jira just by starting and s...

174 views 3 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot