JSFiddle - React, Tailwind, and code Playground
by guest271314
HTML
<div class="login" align="center">
<div class="formWrapper">
<form action="index.php?r=backoffice" method="post">
<input type="text" name="USERNAME" required value="username" defval="username" maxlength="16">
<input type="password" name="PASSWORD" required value="password" defval="password" maxlength="16">
<input type="reset" value="reset">
<input type="submit" value="submit">
<hr/> <a href="#" class="helpLink">Can't log in?</a>
</form>
</div>
<div class="infoWrapper">
<div class="info"></div>
</div>
JavaScript
$(function () {
var elems = $(".login input[defval]");
console.log(elems.length);
$.each(elems, function (i, el) {
if ($(el).val() === $(el).attr("defval")) {
console.log(i, $(el).val() === $(el).attr("defval"), $(el))
};
});
})