I have this piece of code:
<td id="Contacts_detailView_fieldValue_leadsource" >
<span data-field-type="picklist" >
<span >Partner</span>
</span>
</td>
how do i access the value "Partner"? Thank you
CodePudding user response:
You can simply select the parent element and from there go to the child to get the innerHtml
const value = document.querySelector(".value")
const partner = value.children;
// partner[0] is for taking the first element
// and then .innerHTML is for the content inside
console.log(partner[0].innerHTML)
CodePudding user response:
I finally adopted this solution:
function textSpan(id){
const collection = document.getElementById(id);
const value = collection.children;
const final = value[0].children[0].innerText;
return final;
}console.log(textSpan('Contacts_detailView_fieldValue_leadsource'));
Thank you all for the suggestions!