apoorvabade apoorvabade - 8 months ago 45
HTML Question

tooltip when max input length reached

Can i give a tooltip to a input type text in case max length of that textbox is reached in html???


yes, you can set tooltip to text box

 txtname id of youe textbox
 val is value of textbox
 ccount is max length of textbox. 
 if ccount is set to 4 then 
 if value of textbox exceed then 4 then it will show tooltip
function txtToolTip(txtname, val, ccount) {
    var txtTool = document.getElementById(txtname);
    if (txtTool.value.length > ccount) {
        //Setting tool tip value.
        txtTool.title = txtTool.value;

your input box is

<input type="text" name="txtnm" id="txtnm" onkeyup="txtToolTip(this.id, this.value, 4);"/>