Im using this element
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" state="login">
and the script
$("#toggleLogin").click(function() {
if ($("#exampleModal").data("state") === "login") { alert("it works"); } else { alert ("not working");};
<script `src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT" crossorigin="anonymous"></script>`
I look forward having an script, that if the value of "state" is 'login' it will be switched to 'signup' and else will be 'login' back again
I've found this example here but it's not working for me