I am trying to capture the text value of a parent class when a click event happens . In this case the parent class ame is mb-name and will have a "text value" associated with it. I want to capture that text. below is the html.
<div class="mbs-item-inner">
<div class="mb-img">,,,</div>
<h5 class="mb-name">Joe Banker</p>
<p class="mb-title">Banker</h5>
<p class="mb-loc">Virginia Beach, VA</p>
<p class="mb-view">
<a href = "......." class= "btn-ghost-blue" target="_blank">VIEW ME</a> == $0
</p>
the click event happens on the class = mb-view.. I want to capture the class = mb name "in this case Joe Banker". I tried the following
document.getElementByClassName("mb-name").text;
return true;
and a few other variants of document.getElementssbyClassName
but nothing works. I welcome all suggestions.