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 8530279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:13:25+00:00 2026-06-11T09:13:25+00:00

The HTML which should be produced after manipulation: <div class="comments_action_207"> <div class="list_item_comments list_item_comments_207"> <div

  • 0

The HTML which should be produced after manipulation:

<div class="comments_action_207">
   <div class="list_item_comments list_item_comments_207">
      <div class="comment_separator">text goes here</div>
   </div>
</div>

HTML before manipulation:

<div class="comments_action_207"></div>
<div class="list_item_comments list_item_comments_207"><div class="comment_separator">text goes here</div></div>

JavaScript which allows me to do the above manipulation is:

$(function() {
    $('.comments_action_207').click(function() {
        var num = this.className.split('_').pop();
        $('</div>',{'class':'list_item_comments list_item_comments_' + num})
            .append('<div class="comment_separator">text goes here</div>')
            .appendTo(this);
    });
});

I tested the JavaScript above and it works fine. But what I don’t understand is why I don’t have to pass an opening div tag as below. If I pass an opening div tag code does not work as I intend to.

$('<div></div>',{'class':'list_item_comments list_item_comments_' + num}).

If you can please explain it line by line so It’s is easier for me to understand.

  • 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-06-11T09:13:26+00:00Added an answer on June 11, 2026 at 9:13 am

    Your <div> doesn’t close properly:

    $('<div><div/>'
                ^
    

    jQuery accepts <div />, <div> and <div></div>, but nothing else (i.e. no HTML attributes): http://api.jquery.com/jQuery/#jQuery2

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

Sidebar

Related Questions

We have bunch of Domain Entities which should be rendered to an html format,
I'm writing an iPhone app with a UIWebView which should display various html files
I have HTML which includes scripts in following order <script src=../static/js/jquery.js type=text/javascript> <script src=../static/js/bootstrap.js
here is my sample html which is stored in a variable. var sHtml='' sHtml='<div
I Have simple PHP functions that produce html links which should delete a record,
I'm currently trying to deny access to a specific html-document which should only be
Is there any difference between $(#header).empty() and $(#header).html('') ? Also, which should I use?
I have a header.html which start with session_start();. Then the following code, $_SESSION['cart'][$sw_id] is
I have a HTML which has lot of content and a vertical scrollbar appears
I place the .html (which consist of the .js web link) file in the

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.