Compare two date in table columns and perform functions

Compare two date in table columns and perform functions

Dear jQuery Gurus and friends,

I am new in jQuery, i need your help to solve one task.


I have a data table, there are two columns of dates (a target date and actual date).

  1. If actual date column is blank and date past from targeted date, run function 1 (overdue)
  2. If actual date column filled and date past from targeted date, run function 2 (Late completed)
  3. If actual date is happened before targeted date, run function 3 (completed)
  4. If actual date blank,  run function 4 (under process)

  1. var target_Date = jQuery("table tbody tr > td:nth-child(9)").val(); var actual_Date = jQuery("table tbody tr > td:nth-child(11)").val(); if (target_Date > actual_Date) { jQuery("table > tbody > tr > td:nth-child(13)").html('<img src="/images/2.GIF">'); } else if (target_Date < actual_Date) { jQuery("table > tbody > tr > td:nth-child(13)").html('<img src="/images/1.GIF">'); } else if (target_Date == actual_Date) { jQuery("table > tbody > tr > td:nth-child(13)").html('<img src="/images/0.GIF">'); } else { jQuery("table > tbody > tr > td:nth-child(13)").html('Today is Today'); }



I much appreciate your feedback and support from deep heart


Regards,