javascript - error message hide using jquery -
here simple search box error message. error message should not appear on load. if input empty when button clicked, message should appear.
why in code error message appear on load though has kept hidden.
$( document ).ready(function() { $('#error-msg').hide(); }
you not need jquery that. keep simple, add css in beginning:
#error-msg{ display:none; }
and click button code:
$('.input-group-btn').click(function(){ if(!$('#url-input-box').val().length){ $('#error-msg').show(); }else{ $('#error-msg').hide(); } });
Comments
Post a Comment