Triggering modal from text not working

I’ve followed the recommendation here for triggering a modal from some text, Properly remove anchor tag when closing modal content area. but I can’t get it working? I’m sure I’m missing something obvious, but can’t see what, and there are no errors visible in my brosers development tools. Can you help please? Thank you.

I’ve set the modal Toggle Hash to ‘condition-modal’.

Here are the elements I’m using.

(See explanation of ratings)

(function($) {
$(’.open-modal-text’).on(‘click touchend’, function(e) {
e.preventDefault();
$(’[data-x-toggle-hash=“condition-modal”]’).click();
});
})(jQuery);

Hi @pmason,

Thanks for reaching out.
I have visited the given URL but didn’t find any component with data-toggle-hash value of condition-modal. Neither I found the JavaSCript code that is shown in the reference thread. If you have already added the data-toggle and JavaScript code, please let us know which page you have added or which element is assigned with the data-toggle.

Please remember that code in the reference threads is sample code, and it varies from case to case, and we can’t guarantee it works in your case.

Thanks

Hi there @tristup.
Thanks for your assistance with this. The code is within the Layout, “Books product”. The javascript is within the js modal, and my modal is within the layout if you view the Outline. Apologies for omitting this information first time round.

Hi @pmason,

I have found the code into the specified layout but didn’t find the open-modal-text class element on the page. I would suggest you add the class as suggested by my colleague in the reference thread and check if that works.

Please remember that investigating the custom codes and related issues is beyond the scope of theme support.

Thanks

Hi there @tristup.

I’m not sure why you can’t find the open-modal-text class on the page? The text “(See explanation of ratings)” has the class assigned. A simple search within the html output in the developer tools finds it, as does searching for it within the source code for the page?
I realise that custom code may not be within the scope of theme support, but as Themeco supplied the code in the first place, I was hoping you could take a look and see what the issue may be please?

Kindest regards,

Phil.

Sorted it myself now, thank you.

Hi Phil,

Glad that you are able to sort it.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.