3

HTML:

{% for item in result %}
       <tr id="row">
         <td><input name="item" type="checkbox" value="{{ item.number }}"></td>
         <td contenteditable id="col1">{{ item.foo }}</td>
         <td contenteditable id="col4">{{ item.bar }}</td>
       </tr>
{% endfor %} 

I am using facebox . Where I want to show the single row in the facebox which ever i checked ( checked the checkbox, which is in first <td> ). Jquery is:

 $(document).ready(function() {
    $('#edit').click(function() {
        jQuery.facebox({ div: '#row' })
        return false;
    });
});

This jquery is giving me the first row only.

Pointy
  • 405,095
  • 59
  • 585
  • 614
Tauquir
  • 6,613
  • 7
  • 37
  • 48
  • 1
    ID attributes must begin with a letter (`[A-Za-z]`) and may be followed by any number of letters, digits (`[0-9]`), hyphens (`-`), underscores (`_`), colons (`:`), and periods (`.`). http://www.w3.org/TR/html401/types.html#h-6.2 - furthermore, **IDs are unique, meaning only one element in the DOM can have a given ID at any time** -- Anything more than that and jQuery will NEVER find your elements because `getElementById()` only returns ONE element – gnarf Dec 22 '10 at 18:09

1 Answers1

1

You cannot use the same "id" value for more than one element in a page.

You can change that from "id" to "class" and it (might) work. It's hard to tell what exactly you're doing.

  <tr class='row'>
    <!-- ... -->
  </tr>

then

    // ...
    jQuery.facebox({div: '.row'});

Of course you could just find the <tr> elements directly:

    jQuery.facebox({div: 'tr'});
Pointy
  • 405,095
  • 59
  • 585
  • 614