I'm trying to mimic modern browsers' "copy url" functionality.
When viewing the url you don't see the http://
. If you copy it to the clipboard, http://
will be added. So far I have this:
$('#address input').bind('copy', function() {
$.fn.changevalue = function (v) {
return $(this).val(v).trigger('change');
}
var origval = $(this).val();
$(this).changevalue('http://' + origval);
});
This adds the http://
to the input field, if action 'copy' is detected but it stops the copy to clipboard. The function also adds http://
to main input field, that I don't want. I just want to add it to clipboard.