Bootstrap css not working after ajax refresh -


i'm using bootstrap on/off toggle switch. in page, has ajax refresh of every 5 secs reload page content. problem i'm facing when page refresh through ajax, bootstrap-switch loses css style.

i use firefox inspect , saw:

before ajax refresh:

<div id="override"> .....     <div class="margin-bottom-10">  <label for="option1"></label>  <div class="bootstrap-switch bootstrap-switch-wrapper bootstrap-switch-on bootstrap-switch-small bootstrap-switch-animate bootstrap-switch-id-1234>                 <div class="botstrap-switch-container">                   <span class="bootstrap-switch-handle-on bootstrap-switch-primary">on</span>                   <label class="bootstrap-switch-label" for="1234"></label>                   <span class="bootstrap-switch-handle-off bootstrap-switch-default">off</span>                   <input id="1234" name="radio1" class="make-switch" data-size="small" checked="" type="checkbox">         </div>         </div>         </div> ...... </div> 

after ajax refresh:

    <div id="override">     .....         <div class="margin-bottom-10">             <label for="option1"></label>           <input id="1234" name="radio1" class="make-switch" data-size="small" checked="" type="checkbox">         </div> ..........     </div> 

ajax code:

$.get(url, function(data) {   $("#override").html(data); } 

how reload necessary bootstrap css & perhaps js ??

i assume using this

if yes can

$.get(url, function(data) {  $("#override").html(data);  $(".make-switch").bootstrapswitch(); //code init switch again } 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -