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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:49:19+00:00 2026-05-27T09:49:19+00:00

I wrote some simple jQuery code to try and hide rows of an html

  • 0

I wrote some simple jQuery code to try and hide rows of an html table based on the data inside one of the rows columns. The code I wrote works fine in all browsers except IE8, where it completely crashes (IE stops responding, tries to reload the tab and than reports that the page could not load).

If I include

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

the page no longer crashes, but it would be preferable to actually solve this issue rather than applying workarounds.

Here is a sample of the HTML table, and the jQuery code I am using to hide/show rows.

<table>
<thead> ... headers, table has 8 columns </thead>
<tbody>
<!--- The fifth column has a date I need to use to hide/show the rows -->
<tr> ... <td>9/27/2011</td> ... </tr>
...
</tbody>
</table>


function filterData() {
            $("input[type='checkbox']:checked").attr("checked", false);

            //This gets me the date to filter on
            var filterDate = new Date($("#SelectedTimePeriod").val());

            var minDate = new Date($("#SelectedTimePeriod").val());
            minDate.setDate(filterDate.getDate() - 7 * $("#SelectedTimeRange").val());
            var maxDate = new Date($("#SelectedTimePeriod").val());
            maxDate.setDate(filterDate.getDate() + 7 * $("#SelectedTimeRange").val());


            $("tbody tr td:nth-child(5)").each(function () {
                var rowDate = new Date($(this).text());
                if (rowDate.getTime() < minDate.getTime() || rowDate.getTime() > maxDate.getTime())
                    $(this).parent().hide();
                else
                    $(this).parent().show();
            });
        }

The line that seems to crash IE8 is:

$(this).parent().hide();

Any help would be greatly appreciated, also if there is any more information I could provide that could be helpful please let me know.

  • 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-27T09:49:19+00:00Added an answer on May 27, 2026 at 9:49 am

    This might not be an answer but I have made this jsfiddle and it works in all browsers (IE7->9, FF, Chrome).

    I have made some optimizations to your code btw:

    // cache your "static" elements from the page, no need to query for them all the time
    var $table = $('table'),
        $timePeriod = $("#SelectedTimePeriod");
    
    function filterData() {
    
        // only input[type=checkbox] can be "checked" so just write "input:checked"
        // use .prop() for special attributes like checked, selected, disabled...
        $table.find('input:checked').prop("checked", false);
    
        // select the value once for TimePeriod
        var timePeriodVal = $timePeriod.val();
        var filterDate = new Date(timePeriodVal);
    
        var minDate = new Date(timePeriodVal);
        minDate.setDate(filterDate.getDate() - 7);
    
        var maxDate = new Date(timePeriodVal);
        maxDate.setDate(filterDate.getDate() + 7);
    
        // your initial selector was too long
        // find the "tbody" once and only select "td". you can omit "tr", "td" only exist in "tr" anyway
        $table.find('tbody')
              .find('td:nth-child(5)').each(function() {
    
            // select $(this) once and re-use
            var $this = $(this),
                rowDate = new Date($this.text());
    
            // explicitly mark { } and ';' to avoid misinterpretation by browsers
            if (rowDate.getTime() < minDate.getTime() || rowDate.getTime() > maxDate.getTime()) {
                $this.parent().hide();
            }
            else {
                $this.parent().show();
            }
    
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I needed some simple string encryption, so I wrote the following code (with a
I wrote some jQuery code in an external file, with the goal to match
I wrote some sort of console client for a simple application. To be more
I wrote a simple Sinatra app that generate an image using rmagick from some
First of all, I wrote a simple php page, that picks up some variables
Question simple and quick: I have started to use Netbeans to write some code
I would like to write an simple application able to retrieve some certain data
I was attempt to wrap some simple logic into a javascript/jquery closure to bind
I have a some html being generated by JQuery on a Share Point page.
I'm learning JQuery and I wrote a simple AJAX external script for my homepage

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.