Please help me with this form validation. I know its poorly written Im still learning.
/* Its main aim is to alert a person that more than 8 characters is too long. I also used Bootstrap in the process Here is the link to the code: https://code.sololearn.com/WPjDImi0ejv0/#js */ $(function() { $("#demo").keyup(function(){ var len = $("#demo").val(); if(len.length>8){ var el = $("<p></p>").html(""); $("#holder").append(el); $("p").addClass("alert alert-warning"); var x = $("<span></span>").html(" Too long"); $("p").append(x); $("span").addClass("glyphicon glyphicon-alert"); stop(); } else if(len.length<=8){ $("#holder p").children().remove(); } }); });