Adding/passing bootstrap class to the 'div' using javascript or jQuery
<p>Folks!!</p>

<p>I am developing a website, in that showing the field errors in <strong>javascript alert()</strong></p>

<p>User is not satisfy with the alert pop-up each time, and I thought to provide it in inline div block</p>

<p>I want to know how I can pass/add bootstrap class property{<strong><em>alert alert-warning</em></strong>} to the error block when I am passing Error Message from the javascript or jquery.</p>

<pre><code>function getValidateField(){
  var varName= document.getElementById('txtNameSetting').value;
  if(varName.trim().length &lt;= 0){
    //alert("Please enter Application Name");
    document.getElementById('divErrorBlock').innerHTML = "Please enter Application Name";
    document.getElementById('divErrorBlock').style.display = 'block';
    //$('#divErrorBlock').show(); 
    return false;
  }
  else return true;
}
</code></pre>

<p>If I pass inside the 'div', it will visible all the time, I need to hide this blcok until it get invoke</p>

<p>Thank in advance</p>