JSFiddle - React, Tailwind, and code Playground

by webvitaly

HTML

<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<form class="well">
    <p>
        <input type="text" class="form-control target1" value="click or focus this input to select text in it">
    </p>
    <p>
        <input type="text" class="form-control target2" value="try to select text in this input">
    </p>
    <div class="log"></div>
</form>

JavaScript

$(function () {
    $('input.target1').focus(function () { // select text on focus
        $(this).select();
    });
    $('input.target1').mouseup(function (e) { // fix for chrome and safari
        e.preventDefault();
    });
    $('input.target2').select(function () {
        $('.log').append(' Handler for .select() called. ');
    });
});