Bootstrap alert messages with one Jquery function

Today i will show you how to use one Jquery function to show all bootstrap messages in whole application you don’t have to copy paste the whole bootstrap message structure just call the function with parameter.

 function showalert(message,alerttype) {
      if (typeof(message)==='undefined') message = "message not found";
    if (typeof(alerttype)==='undefined') alerttype = "info";
    $('.container').append('<div class="alert alert-'+alerttype +'">×'+message+'</div>')


Leave a Reply

Your email address will not be published. Required fields are marked *