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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:24:18+00:00 2026-06-16T20:24:18+00:00

Hello guys i have a pretty standard div with css and i would like

  • 0

Hello guys i have a pretty standard div with css and i would like to append to a div that already exists with a given class.
here is my mark up

<div id ="one" class="PortalBox">

     </div>

   <div class="ab_Box1d">
                <div style="width:600px;">
                    <%@ include file="./concur-reports/index.html"%> 
                </div>
    </div> <!--finish ab_box1d-->  


</div>

here is my jquery.

 $(document).ready(function() {
$(".PortalBox").each(function(){
    var ThisCss = $('<div class="ab_Box1a" id="report1" style="width:640px; padding-top:6px;">'+   
            '<div class="ab_Box1b" id="reportchild1"> </div>' +
                '<table class="ab_Box1c" width="100%" border="0"'+
                  'cellspacing="0" cellpadding="0">'+
              '<tr>'+
                  '<td style="text-align:left">Concur Reports</td>'+
              '</tr>'+
          '</table>'
   +
     '</div>' )
     ThisCss.insertAfter('.PortalBox');
   });
});

so basically I’m trying to append the markup in jquery when i stumble upon any div with class “PortalBox” however i need to make a part dynamic wich would basically be a title
this part

 '<td style="text-align:left">my channel</td>'+

need to be dynamic to pick up the title from another HTML attribute withing the div.
can i add a “title” attribute to the div tag with a value and how do i make this possible with jquery? or java-script I’m open to any ideas so alternate solutions.
Thanks in advance.

  • 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-16T20:24:19+00:00Added an answer on June 16, 2026 at 8:24 pm

    Put the title in a data-* attribute:

    <div data-title="my channel" class="PortalBox"></div>
    

    You can then retrieve it with jQuery:

    $('.PortalBox').data('title');
    

    Here’s the complete code:

    $(document).ready(function() {
        var report = $('<div class="ab_Box1a" style="width:640px; padding-top:6px;">'+   
            '<div class="ab_Box1b" ></div>' +
            '<table class="ab_Box1c" width="100%" border="0"'+
            'cellspacing="0" cellpadding="0">'+
            '<tr>'+
            '<td style="text-align:left">Concur Reports</td>'+
            '</tr>'+
            '</table>'+
            '</div>');
    
        $(".PortalBox").each(function() {
            report.clone()
                .find('td').text( $(this).data('title') )
                .appendTo(this);
        });
    });
    

    Please note that constructing HTML fragments like this is extremely error prone. If you find yourself doing this often, you should look into using a templating system.

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

Sidebar

Related Questions

Hello guys I have a DIV that I got passed trought a js function
Hello guys have a div that is outside of a table and I want
Hello guys i have server A where i would like to put a link
Hello guys I have this drop down menu: <ul id=menu> <li class=dropDown><a>DropDown</a> <div id=container>
Hello guys i have been using JavaFx scene builder to build a gui that
Hello guys I'm creating an application that have a widget the application and the
Hello guys I have a map like this http://sinanisler.com/demo/map/ and as you can see
Hello Guys I have msg box when i press on yes its close that
Hello guys I want to have something like JQuery selectors. What I mean is
Hello guys I have a List that I want to show for all users

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.