Nokogiri id attribute not functioning

I’m building an app in rails using Nokogiri … I used puts documents.css("._Ak cite").length and I get the exact length I want but when I tried the id part of the of thisputs documents.css(“div#mbEnd > cite”).length I didn’t get the exact, makes 0 length.

I don’t know why nokogiri not recognizing the tag.

Sounds like it just doesn't match your document but without seeing an excerpt there's not much more that can be said.

Fred

I really don’t why I can’t get the data if I used id because when I tried the class it will gives the exact data. Is there any ways that can I used id to fetch the data?

Per https://api.jquery.com/category/selectors/

Child Selector (“parent > child”)

Selects all direct child elements specified by “child” of elements specified by “parent”.

Double check how you are referencing the parent and the children

I grabbed this code from https://api.jquery.com/child-selector/, modified it and it works. Just remember that multiple elements can have the same css class, but each element must have a

distinct css id.

<!doctype html>

child demo body { font-size: 14px; }
  • Item 1
  • Item 2
    • Nested item 1
    • Nested item 2
    • Nested item 3
  • Item 3
  • Item 1
  • Item 2
    • Nested item 1
    • Nested item 2
    • Nested item 3
  • Item 3

Hope this helps.
Liz