Saturday 18 November 2017

Calculate textarea characters using jquery

/////////////////////// html

<asp:TextBox ID="txt_Remarks" runat="server" CssClass="form-control" TextMode="MultiLine"

 MaxLength="150" Height="50px" onkeyup="return txt_area_Charc(this, 'txtCCountChar', 150)"></asp:TextBox>


//plugin-


     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>


///////////// js
function txt_area_Charc(val, txtcid, mval) {
    var len = val.value.length;
    if (len >= mval) {
        val.value = val.value.substring(0, mval);
        if (len == mval && txtcid != "") {
            $('#' + txtcid).text((mval - (len)) + " Character Left");
        }
        return false;
    } else {
        if (txtcid != "") {
            $('#' + txtcid).text((mval - (len)) + " Character Left");
        }
    }

}

// result


No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...