[Solved] HTML Input (Javascript) [closed]


I have created a JSFiddle to demonstrate this. When you type in the email and then leave the input box, it shortens. When you re-enter the input box it expands back to its full length…

$('#email').bind('change', function () {
    $self = $(this);
    var fullEmail = $self.val();
    var shortEmail = fullEmail;
    if(fullEmail.length > 15) {  
        shortEmail = fullEmail.substr(0, 14)+'...';
        $self.val(shortEmail );
    }

    $self.bind({
        focus: function () {
            $self.val(fullEmail);
        },
        blur: function () {
            $self.val(shortEmail);
        }
    });
});

3

solved HTML Input (Javascript) [closed]