HTML / PHP如何在模态中显示错误div元素

I have a login modal with an integrated error message but i don't know how to display it.

Error message:

<div id="loginErrorMsg" class="alert alert-error hide">Wrong username og password</div>

Thanks Jay

I think that your problem is not PHP, is javascript logic flow that you must do in order to show the error to the user.

class="alert alert-error hide"

The css class "hide" should hide the error message, then you must remove the "hide" class to display the div, for example with JQuery:

$('#loginErrorMsg').removeClass('hide')

You can then hide the error message again by re adding the "hide" class. Again for example, with Jquery.

$('#loginErrorMsg').addClass('hide')

Hopefully now you can see this is a JavaScript problem, not a PHP problem.

Best regards, Rafael