mardi 14 juin 2016

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 all text on click in #url input, beside text in ajax generated input. All I want is to make text in both static inputs and ajax generated inputs selected on click.


Aucun commentaire:

Enregistrer un commentaire