This is basically a follow up to my yesterday's question.
I managed to get a span perfectly on top my my input text (the span should be replicating the input text).
Since there doesn't seem to be a good way of hiding the original input text, I decided to just update the span rapidly enough to make it seamless, like this:
var updatespan = function(){
document.getElementById('street1span').innerHTML = document.getElementById('street_1').value.substring(0, 15) + '<span style="color: red;">' + document.getElementById('street_1').value.substring(15) + '</span>';
};
$('street_1').on('focus', function(e){
interval1 = setInterval(updatespan, 10);
});
Now I am wondering how resource intensive updating a span every 10ms would be? (I do clear the interval on blur)
I know JQuery is client side, but I just have a hard time putting things into perspective.
Of course, if there is a better way of doing this I would be happy to hear.