Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <table>
- <tr>
- <td class="selector">
- <input type="checkbox" name="folders" value="67">
- </td>
- <td class="name">
- <a>Item 15</a>
- </td>
- <td class="creator">
- <span class="creator">Your Name</span>
- </td>
- <td class="last_modified">
- <time class="" datetime="2012-11-11T00:08:09Z">Nov-10 4:08 PM</time>
- </td>
- <td class="actions">
- <div class="actions-group">
- <a class="dropdown-toggle" data-toggle="dropdown">
- <i class="icon-gear">Settings</i>
- <i class="icon-caret"></i>
- </a>
- <ul class="dropdown-menu dropright">
- <li><a data-rename="true">Rename</a></li>
- <li><a data-archive="true">Delete</a></li>
- </ul>
- </div>
- </td>
- </tr>
- </table>
- $("table").delegate("td", "click", function(e) {
- console.log(e);
- // e.delegateTarget === your table element
- // e.currentTarget === the td clicked
- // e.target === the actual element that you clicked
- });
- $("table").on('click', '.noclick', function (e) {
- e.stopPropagation();
- }).on("click", "td", function(e) {
- console.log(e);
- });
- <input type="checkbox" class="noclick" name="folders" value="67">
- $("table").on('click', 'td:not(.noclick)', function (e) {
- console.log(e);
- });
- $("table").on('click', 'td', function (e) {
- if ($(this).hasClass('noclick')) { return; }
- console.log(e);
- });
- <td class="selector noclick">
- <input type="checkbox" name="folders" value="67">
- </td>
- $("table").on("click", "input", function(event){
- var clicked_checkbox = $(this);
- });
- $("tr").click(function(event){
- if(!$(event.srcElement).is("a"))
- {
- var checkbox = $(this).find('input[type="checkbox"]');
- $(checkbox).prop("checked",!$(checkbox).prop("checked"));
- }
- });
- $("table").delegate("td", "click", function(e) {
- // Default stuff...
- console.log(e);
- });
- $( 'a' ).click( function() {
- // Do something else...
- return false;
- });
- $( 'input[type="checkbox"]' ).click( function() {
- // Do something else...
- return false;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement