I want to select only whose parents have display: block and exclude those whose parents have display
You can check with jquery. The code below means
"Get all buttons, filtered by ones whose parent is visible on page", loop through and print html of each one.
$(document).ready(function(){ $(":button").filter(function() { return $(this).parent().is(':visible') }).each(function(){ console.log($(this).html()); }); });My name is someone.
I live somewhere.
My best friend is someone.
Who is your favourite: