PHP has a useful function isset(), with which you can check whether a variable exists so as not to get errors.
To do this, you can use the jQuery library and the .length property. Using .length you can search to see if an element exists on the page, and if it exists, you can continue to execute the code.
If you have any questions, want to get individual advice or you have an interesting offer, you can contact via the feedback form.
Or write to the email firstname.lastname@example.org