cancel
Showing results for 
Search instead for 
Did you mean: 

Add class or id to message div

Add class or id to message div

Hello! 

 

I'm working with Magento 2 as a project in school and I'm currently writing tests in Casper.js to test the client and have a hard time to grab information from the messages, for example "You product to your shopping cart." which is located inside the div with "data-bind="html: message.text"" attribute in it. It would be much easier if I were able to add a custom class or id to that div instead. 

 

Any ideas on how to do this the best way? Thanks

2 REPLIES

Re: Add class or id to message div

I'll update my initial question.

 

Speaking of containers and blocks, where can I find the div? I am trying to use a module to add a class to this div.

Re: Add class or id to message div

Hello Lokecarlsson,

You need to modify phtml file of core( if you're not working on your custom theme), which is not a good idea.

The best approach is to override core layout and define your custom phtml. Visit the following for more detail.

 

How To Override Phtml File In Magento2

In Magento 2 How to Override phtml or layout core files?