Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error : $val.val() undefined when input is empty #1

Open
azhilov opened this issue Feb 15, 2018 · 1 comment
Open

Error : $val.val() undefined when input is empty #1

azhilov opened this issue Feb 15, 2018 · 1 comment

Comments

@azhilov
Copy link

azhilov commented Feb 15, 2018

Error : $val.val() undefined when input is empty.
Solution:

if (!$wrap.find('.text-limit').length) {
    var val = $val.val() || '';

    $parent.length ? $parent.append(counterElm) : $wrap.append(counterElm);
    $wrap.find(settings.target).html(val.length);
    $wrap.find(settings.maxTarget).html('/' + maxLength);

    $wrap.on('keyup', settings.valName, function (e) {
        var input = e.currentTarget;
        var val = input.value;

        if (val.length > maxLength) 
            input.value = val.substr(0, maxLength);

        $wrap.find(settings.target).html(input.value.length);
    });
}
tg0825 pushed a commit that referenced this issue Feb 19, 2018
tg0825 pushed a commit that referenced this issue Feb 19, 2018
@tg0825
Copy link
Owner

tg0825 commented Feb 19, 2018

@azhilov thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants