I want to read a normal textfile line-by-line. Each line should be copied to the clipboard (Internet Explorer), and when the user pastes the clipboard (into an input field) the next line should be copied to his clipboard.
My code looks now like this:
<script>
$.get('list.txt', function(data) {
var lines = data.split('\n');
for (var i = 0, len = lines.length; i < len; i++) {
window.clipboardData.setData('Text', lines[i]);
}
});
$('#text').bind("paste", function(e) {
$("#output").html(window.clipboardData.getData('Text'));
});
</script>
My problem is I don't know how to stop the loop until the user pastes his clipboard, and then to continue.