So I have been trying to get this working for 2 days now and still no luck. I have a function that counts the characters of a textbox and display the results in a label.

function textCounter2(field, counter, maxlimit) {

    if (field.value.length > maxlimit)
        field.value = field.value.substring(0, maxlimit);
    else
        document.getElementById('subtitlecount_lbl').innerText = maxlimit - field.value.length;
}

What I am trying to do is to use (input variable counter) inside getElementByID instead of manually typing subtitlecount_lbl.

I need to use the same function for about 15 textbox and labels.

Related posts

Recent Viewed