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

  • Home
  • SEARCH
  • 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 6014897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:45:31+00:00 2026-05-23T02:45:31+00:00

I have a table that looks like this: I have this same chart on

  • 0

I have a table that looks like this:

I have this same chart on a few pages hard coded.

I want to be able to change the tables on all the pages using js and jQuery

I want to make it so that the YTD button is next to the From Date input
and the MTD is next to the To Date input.

I have tried to do that here:
http://jsfiddle.net/maniator/W9YFF/9/

But it seems that it gets messed up at some points.

How do I fix that?


UPDATE

If I try doing

$('input[type="button"][value="YTD"]').insertAfter($('#fdate'));
$('input[type="button"][value="MTD"]').insertAfter($('#tdate'));

My result looks like this:

  • 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-23T02:45:32+00:00Added an answer on May 23, 2026 at 2:45 am

    Did I misunderstand something crucial here, or just do this?

    $('input[type="button"][value="YTD"]').insertAfter($('#fdate'));
    $('input[type="button"][value="MTD"]').insertAfter($('#tdate'));
    

    example: http://jsfiddle.net/niklasvh/TghZ3/

    edit

    If you want to edit the table structure instead, you could do this:

    $(".main tr:not(:first):not(:last)").append($('<td />'));
    $(".main tr:first th, .main tr:last td").attr('colspan',3);
    
    
    $(".main tr:lt(2) td:last").append($('.YTD'));
    $(".main tr:lt(3) td:last").append($('.MTD'));
    

    example: http://jsfiddle.net/niklasvh/TghZ3/41/

    edit 2

    If you just want to add new cells to those 2 rows and colspan the rest:

    $(".main td:last-child:not(.first)").attr('colspan',function(i,a){
        if (typeof a == "undefined") a = 1;
        return (parseInt(a)+1);
    });
    
    $(".main tr:first th, .main tr:last td").attr('colspan',3);
    
    
    $(".main tr:lt(2) td:last").attr('colspan','').after($('<td />').append($('.YTD')));
    
    $(".main tr:lt(3) td:last").attr('colspan','').after($('<td />').append($('.MTD')));
    

    example: http://jsfiddle.net/niklasvh/TghZ3/57/

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

Sidebar

Related Questions

I have a table that looks like this: nid vid tid 1 2 3
I have a table that looks like this: <table> <thead> <!-- random table headings
I have a table that looks like this: |StreetName NR| NR | |Teststreet 34|
I have a table that looks like this: id count 1 100 2 50
I have a table that looks like this for about ~30 students: StudentID Course*
So I have a table that looks like this: ProjectID TaskID Date 000 001
I have a table that looks something like this: word big expensive smart fast
I have an HTML table that looks like this: ------------------------------------------------- |Column 1 |Column 2
I have a table that looks something like this: id | firstperson | secondperson
I have a LaTeX table that looks like this: \begin{table}[!ht] \centering \small \caption{ \bf{Caption}}

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.