troubleshooting Question

Detecting when button is clicked using Javascript based off of custom attribute name?

Avatar of MJ
MJFlag for United States of America asked on
Web DevelopmentJavaScript* HTML 5
2 Comments1 Solution84 ViewsLast Modified:
How would I detect when this button
<button class="btn btn-mobile btn-page-next btn-next-residency" data-name="btn-page-next" type="button">CONTINUE<i class="icon-arrow-thin-right"></i><i class="spinner"></i></button>

Open in new window

is clicked? I tried :
    function _dtmCheckContinue(){
        document.body.addEventListener('click', function(event) { 
	      if(( == "button")){ 
             if( == "btn-grp-next"){
             console.log("<=====> CONTINUE BUTTON CLICKED");

Open in new window

I can never get into the if statement on line 4 so obviously there is an issue there.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros