javascript - Make text in ajax generated input field selectable -
i can't make text in ajax generated input field selectable on click.
<input type="text" class="form-control input-lg" id="url" value=""> <script> $.ajax({ ... element.append('<input type="text" id="test" value="' + 'https://' + location.host + '/' + data[0].data + '">') } }); return false; }); </script> <script> $('input').on('focus', function (e) { $(this) .one('mouseup', function () { $(this).select(); return false; }) .select(); }); </script>
i can select text on click in #url input, beside text in ajax generated input. want make text in both static inputs , ajax generated inputs selected on click.
$('body').on('focus', 'input', function () { $(this).select(); });
Comments
Post a Comment