javascript - jquery function is only working in the console -



javascript - jquery function is only working in the console -

i have script supposed wait dom loaded fire doesn't seem wait. think problem might using bootstrap tabs , content isn't in dom yet.

it works if paste jquery console. there way prepare jquery or need powerful ajax library?

html/bootstrap

/*@include('blocks.rotators.user-comments') loads in this*/ <div class="tab-pane fade" id="activitydetails"> <div class="comments-holder holder"></div> <!-- item container --> <ul id="comments-container" class="default-container quad-scroller"> <li>item</li> </ul> </div>

js

/* when document ready */ $(function () { /* * initiate plugin without buttons , numeration * setting midrange 15 prevent breaks "..." */ $("div.comments-holder").jpages({ containerid: "comments-container", first: false, previous: "←", next: "→", last: false, midrange: 15, perpage: 4, links: "blank" }); });

you should using bootstrap event fired when tab shown , visible.

$('a[data-toggle="tab"]').on('shown.bs.tab', function(event) { // set code });

the selector button clicked access tab. event guarantee tab loaded , visible.

if you're not bothered beingness visible , want access before can utilize bootstrap event show.bs.tab instead fired click on tab.

javascript jquery ajax twitter-bootstrap

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -