Check the text within a div element from controller

Is there any way to check for a specific line of text within a div
element from the controller?

I’m changing a block of filtered results and the text in a div element
(‘Show All’ vs. ‘Limit to Mine’). When another filter is run against
the same block of filtered results I want to see which text is inside
the div (‘show all’ or ‘limit to mine’), so I’ll know if I should
include [“people_id = ?”, @person] in my list of conditions.

I know I could set a database field everything I change the div, but is
there anyway to just check the div while building the condition string?