Count cells by content

Count cells by content

lunguc@hotmail.comlunguc@hotmail.com Posts: 20Questions: 6Answers: 0

Hi,
I need to count the cells that contain a span with class '.editable'

Answers

  • allanallan Posts: 64,961Questions: 1Answers: 10,759 Site admin

    table.cells().nodes().to$().find('.editable').length.

    Reference docs:

    Allan

  • lunguc@hotmail.comlunguc@hotmail.com Posts: 20Questions: 6Answers: 0

    Hi Alan,
    It's working in console but not in script.

        alert(table_di.cells().nodes().length); //this work
        alert(table_di.cells().nodes().to$().find('.editable').length); //this not work
    
  • lunguc@hotmail.comlunguc@hotmail.com Posts: 20Questions: 6Answers: 0

    I found the problem. I forgot to run the script inside the document ready

    Thank you Allan.
    Great job.

This discussion has been closed.