way to find unique selector

parth_gupta199
Silver Contributor
Silver Contributor parth_gupta199

Hi Everyone,

My website is design in ember, so it's id keeps on changing everytime we refresh the page and all the button across site has same class name. So while making extension i am facing problem as that jQuery selector fires everywhere that button is present. I am not able to narrow down to particular button. Attaching screenshot of the extension and my website code.

 

Extension:

Capture1.PNG

 

Website Code:

Capture2.PNG

What approach should be used here. So that my extension runs properly on click of particular button only.

1 REPLY 1

way to find unique selector

Tealium Expert
Tealium Expert

@parth_gupta199 

If you are trying to traget a button which is present only  on a single page then can you try using a URL check condition before triggering the utag.view call in custom code.

if (document.URL.toString().toLowerCase().indexOf('URL GOES HERE') > -1) {
    utag.view({
        'form_error': 'This field is required'
    })
}

Hope this helps.

Thanks