Javascript වැඩ්ඩො help pls

chatura_CN

Well-known member
  • Jun 2, 2016
    6,462
    1
    8,634
    113
    kandy

    මචං html form එකක text box වලට validations දාන්නේ කොහොමද බං. :oo:

    Codes තියනවා නම් දෙන්න pls
     
    • Like
    Reactions: imhotep

    thedigit2s

    Well-known member
  • Oct 3, 2009
    2,768
    3,176
    113
    37
    @ katubedda
    HTML:
    <input id="input" onChange="function();" value=""> <p id="validationError">-</p>

    <script> function() {
    var input=$("#input").val();

    /// validation check ///
    if error ->- $("#validationError").html("error"); /// show error on tag
    $("#input").val(""); // clear input.


    } </script>
     
    • Like
    Reactions: chatura_CN

    chatura_CN

    Well-known member
  • Jun 2, 2016
    6,462
    1
    8,634
    113
    kandy

    HTML:
    <input id="input" onChange="function();" value=""> <p id="validationError">-</p>

    <script> function() {
    var input=$("#input").val();

    /// validation check ///
    if error ->- $("#validationError").html("error"); /// show error on tag
    $("#input").val(""); // clear input.


    } </script>


    Thanks bois :love: rep