Configuration of Webshims input widgets
HTML
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<form>
<input name=jquery type=text value="foo"></input>
<input name=addeventlistener type=text value="bar"></input>
<ul></ul>
</form>
JavaScript
$(function () {
$(document).on('focus', 'input[name=jquery]', jSelect);
document.body.addEventListener('focus', aSelect, true);
});
function jSelect() {
log("<li>jquery: The text '" + this.value + "' in input field named " + this.name + " should be selected");
this.select()
}
function aSelect(e) {
var event=event || e;
var target = event.target || event.srcElement;
if (target.name && target.name == "addeventlistener") {
log("<li>addeventlistener: The text '" + target.value + "' in input field named " + target.name + " should be selected");
target.select();
}
}
function log(msg)
{
$("ul").append(msg);
}