I know this is possible in javascript by using window.getSelection() method but I'm not familiar with this selection object. Can you help me to write a code to make user's writing cursor to be always at the begining of the input string?
$('input[type="text"]')
    .attr('maxlength','7')
    .keyup(function(){
        var sel = window.getSelection();
        console.log(sel);
        // need a code for here to make the cursor (caret) at the begining of the string
    })