Skip to main content
added 164 characters in body
Source Link
Jouke Waleson
  • 517
  • 1
  • 3
  • 15

Simply put it in $(document).ready(); It will then execute when your document is loaded. Something like this:

$(document).ready(function(){
    alert($("#divId").html());
});

Edit (see comment):

$(document).ready(function(){
    $('.yourdivclass').each(function() {
        alert($(this).html());
    });
});

Simply put it in $(document).ready(); It will then execute when your document is loaded. Something like this:

$(document).ready(function(){
    alert($("#divId").html());
});

Simply put it in $(document).ready(); It will then execute when your document is loaded. Something like this:

$(document).ready(function(){
    alert($("#divId").html());
});

Edit (see comment):

$(document).ready(function(){
    $('.yourdivclass').each(function() {
        alert($(this).html());
    });
});
Source Link
Jouke Waleson
  • 517
  • 1
  • 3
  • 15

Simply put it in $(document).ready(); It will then execute when your document is loaded. Something like this:

$(document).ready(function(){
    alert($("#divId").html());
});