i cant set a custom attribute for my button. Here is my code please check it, thanks.
btn.setAttribute('@click.prevent', 'login()')
<button name="user-auth-submited" id="user-auth-submit" type="submit">ثبت نام</button>
I'm using alpine.js
and I should have to use the @
and I want to toggle attribute @click.prevent', 'login() to @click.prevent', 'register()
CodePudding user response:
The @
symbol is for JQ. You don't need it here as it is explicitly an attribute. Try using 'click.prevent'
instead.
CodePudding user response:
i usign alpine.js and I should have to use the @ and i want to toggle attribute @click.prevent', 'login() to @click.prevent', 'register()