Selecting checkbox in facebox and jquery?

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 use facebox. Where I want to show a single line in faceboxthat I have ever checked (check checkboxwhich is in first <td>). JQuery:

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

This jquery only gives me the first one row.

+3
source share
1 answer

You cannot use the same "id" value for multiple elements on a page.

You can change this from "id" to "class" and work (maybe). It's hard to say exactly what you are doing.

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

then

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

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

    jQuery.facebox({div: 'tr'});
+1
source

Source: https://habr.com/ru/post/1781709/


All Articles