I'd like to do the following. I got a button like this:
<button class="uk-button uk-position-bottom" onclick="search.start()">Start search</button>
The JS part is this:
var search = new SiteSearch();
Now I'd like to do this:
Once clicked, the label of the button should show Stop search
. And the called function should be search.stop()
. If the user clicks Stop search
, the button should be the Start search
button again.
How can I do this in an elegant way?