Autocomplete Javascript Component

I’m working as an end user in a Confluence Server environment. I do not have access to the administration area and my primary development work consists of leveraging the underlying AJS.$ JQuery framework.

I recently came accross the autocomplete input field which was perfect as a front end page selector for a REST api call I’ve already executed on the page.

console.log(AJS.$(“input.autocomplete-page”).value);

<input class=“autocomplete-page” data-max=“10” data-none-message=“No results” data-template="{title}">

The problem is, I’m trying to get the value of the selected page and I’ve been unable to get the value.

data-target doesn’t work for me
accessing the value with an onchange yields either nothing or undefined

The documentation is here: https://developer.atlassian.com/server/confluence/javascript-components/

I’m not doing macro development, I’m only able to use this while working in the html macro.

Does someone know how to capture the selected value from the autocomplete component?

Have you tried .val() instead of .value?

That did the trick. It’s always the simple things.