2 Replies - 934 Views - Last Post: 10 September 2012 - 01:11 AM

#1 webwired  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 33
  • View blog
  • Posts: 339
  • Joined: 26-August 07

Question about making a TD cell clickable

Posted 07 September 2012 - 05:56 PM

Hello Everyone...

So, I have done tons of research and found tons of examples of how to make a TD cell clickable, BUT, I can't seem to manage to make any of them work for my own code... Perhaps the problem is in how I set up the table, I'm not sure as most examples that I have found don't actually show that part of it... Anyway, here's what I have...

Here's the Table and Form code...
echo '<form id="CalendarCell" action="calendar.php?eventaction" method="post">';
echo '<input type="hidden" id="SelectedTime" name="SelectedTime" value="'.$LoopTime.'" />';
echo '<td class="appointment">&nbsp;</td>';
echo '</form>';



Here's one of the jQuery code snippets I have tried...
<script src="https://code.jquery.com/jquery-latest.js"></script>
<script>
    $("#CalendarTable").delegate("td", "click", function() {
        $(this).find("form").submit();
    });
</script>



Is This A Good Question/Topic? 0
  • +

Replies To: Question about making a TD cell clickable

#2 e_i_pi  Icon User is offline

  • = -1
  • member icon

Reputation: 789
  • View blog
  • Posts: 1,676
  • Joined: 30-January 09

Re: Question about making a TD cell clickable

Posted 08 September 2012 - 01:57 AM

.delegate() has been superceded by the .on() method. You can read about it here, which also gives the alternative stnyax for using .on().
Was This Post Helpful? 0
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3485
  • View blog
  • Posts: 10,052
  • Joined: 08-June 10

Re: Question about making a TD cell clickable

Posted 10 September 2012 - 01:11 AM

besides that you donít have a table. <td>s must be put inside <tr>s (should be put inside <tbody>, <thead> or <tfoot>) must be put inside <table>. there are no other parent elements allowed (no intermixing with <form> either) otherwise the browser assumes something to render the source code somehow, which usually ends up unpredictably.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1