Link to home
Start Free TrialLog in
Avatar of MJ
MJFlag for United States of America

asked on

Extract Text From Modal using JavaScript?

How would I extract the text (Unfortunately, we don't yet operate in New Jersey. We are still growing!) from the below modal code, using JavaScript?

<div class="modal-overlay">
    <div class="modal-container" role="dialog" aria-labelledby="title-text" aria-describedby="dialog-text">         <div class="modal-icons">             <div class="modal-header-exit"></div>             <div class="modal-header-icon"></div>         </div>         <div class="modal-header">             <h4 tabindex="-1" class="modal-header-title" id="title-text">State limitations apply</h4>         </div>         <div class="modal-content-container">             <p>Unfortunately, we don't yet operate in New Jersey. We are still growing!</p>             <div class="flexbox jc-center fd-row">                 <div class="button-container"><button type="button" class="button mt-4 button-primary button-full">Good to know</button></div>             </div>         </div>     </div> </div>

Open in new window


Avatar of lenamtl
Flag of Canada image

What do you mean exaclty by extract?
What is the case?
Avatar of MJ


I need to grab the text "Unfortunately, we don't yet operate in New Jersey. We are still growing!" from the modal. The text will obviously change. I need a JS function that will return that string. Hope this makes sense? FYI... I have to use a Tag Manager so I have to inject my code. I can't modify the mark-up of the page. This is for analytic purposes.
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial