Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4119866
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:08:46+00:00 2026-05-20T23:08:46+00:00

Can anyone explain why this jQuery .html() function is not outputting anything? I’m new

  • 0

Can anyone explain why this jQuery .html() function is not outputting anything?
I’m new too jQuery and cant seam to spot anything, if you can please tell me 😀

I’ll just include the html, nothing else:

 <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="jquery.scrollTo-1.4.2.js"></script>
    <script type="text/javascript">
        //when the DOM is ready 
        $(document).ready(function(){

            var like_count = <?php print "23"; ?>;
            //Scripts for getting number of comments for this post
            var comment_count = <?php print "12"; ?>

            var thumnail_path - "";
            var time_ago - "";


            //settings on top
            var doindex = 'comments.php?item_id=';
            var initialPosts = <?php echo get_posts(0,$_SESSION['posts_start']); ?>;
            //function that creates posts
            var postHandler = function(postsJSON) {
                $.each(postsJSON,function(i,post) {

                    //post url
                    var postURL  = '' + doindex + post.item_id;
                    var id = 'post-' + post.ID;
                    //create the HTML
                    $('<div></div>')
                    .addClass('post')
                    .attr('id',id)


                                //Script for getting the number of likes for this post




                    //generate the HTML
.html('<table width="244" height="121" border="0" cellpadding="0" cellspacing="2" ><tr><td height="24" colspan="2" bgcolor="#0270B7"><table width="410" border="0"><tr> <td width="404" height="20" class="username"><a href="../profile.php?user=' + post.username + '" class="username">&nbsp;' + post.username + '<span class="name">&nbsp;' + post.name + '</span></a></td></tr></table></td></tr><tr> <td width="51" bgcolor="#Edeff4"><span class="thum"><img src="' + thumnail_path + '" alt="" width="50" height="50" /></span></td><td width="355" height="50" bgcolor="#Edeff4" class="content">&nbsp;' + post.item_content  + '</td></tr><tr><td height="19" colspan="2" bgcolor="#Edeff4" class="content"><a href="comment.php?id=' + post.item_id + '"  class="post-title">&nbsp;<span class="post-title">comment </span></a><a href="#"  class="post-title">(' + likecount + '</a><a href="comment.php?id=' + post.item_id + '"  class="post-title"><span class="post-title">)</span></a> <span class="post-title"><a href="#"  class="post-title">likes (' + likecount + ') &nbsp;' + time_ago + '</a></span></td></tr><tr><td height="18" colspan="2" class="content">&nbsp;</td></tr></table>')

Thanks :))

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:08:46+00:00Added an answer on May 20, 2026 at 11:08 pm

    Assuming you haven’t left out part of your script, it doesn’t look like you’re ever adding your div to the body somewhere.

    After your html call, put .appendTo('body'). Example:

    $('<div></div>').html("Some stuff...").appendTo('body');
    

    Of course, you can use whatever function you want to place it in the document.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone explain me how to do this, jquery's api is really lacking on
Can anyone explain this strange behaviour in jQuery? I'm using version 1.5.2. var myxml
Can anyone explain what this mod_rewrite rule is doing? I'm trying to comment the
Can anyone explain why this code gives the error: error C2039: 'RT' : is
Can anyone explain to me what this means? Run-Time Check Failure #0 - The
Can anyone explain to me why this isn't working? #include <stdio.h> #include <stdlib.h> char
Can anyone explain to me the purpose of ungetch? This is from K&R chapter
Can anyone explain why the following jquery only fires the 2nd toggle event and
My HTML looks like this: <html> <head> <title>Test</title> <script type=text/javascript src=jQuery.js></script> <script type=text/javascript> function
Can anyone explain why $(this).is(:checked) gives the opposite result when the checkbox is clicked

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.