jQuery Simple Example
HTML
<script src="//www.addressfinder.co.nz/assets/v2/widget.js"></script>
<input name="author" type="text" id="author"></input>
<div class="click-me">
Click me
</div>
CSS
.click-me{
width: 100px;
height: 50px;
background: tomato;
}
JavaScript
$(".click-me").click(function(event){
var authorInput = document.getElementById("author");
var authorName = "some text";
authorInput.value = authorName;
var that = this;
setTimeout(function(){ that.selectionStart = that.selectionEnd = 10000; }, 0);
});