How you might use jQuery to filter elements by their data Attribute values. This code snippet grabs all divs that have an id beginning with “proto_” and have a data attribute of “state” with value “open”.
return ($(this).data("state") == "open")
I’ve done a quick demo in jsfiddle to demonstrate. http://jsfiddle.net/qgwnY/
Check this out on jsfiddle.