jQuery Archives - Magesan

Category: jQuery

How to write jquery in phtml file in magento 2

We need to write jquery sometimes in phtml file for special requirement. For that you need to define jquery in require function in script tag for using jquery within phtml file.Put below script in phtml file and replace console.log with your custom code.

Set interval using jquery

Set interval is very important method, which is simultaneously checks for the element if the element is exists or not. It is invoke to the time you provided in interval function, And it will continue to invoke till then the element is not found.