I'm making a registration and login to a jquery mobile project and want it to display popup error messages. I've been hunting through here but can't seem to get anything to work. I tried using another question on here, hence the lnkDialog
bit, but that doesnt work. I want to replace all the alerts with popup message box's. I currently have
<div data-role="page" data-theme="b">
<div data-role="header">
<a href="index.html" data-rel="back" class="ui-btn-left ui-btn ui-btn-icon-notext ui-corner-all ui-icon-back">Back</a>
<h1>Workout Planner</h1>
</div
<div role="main" class="ui-content">
<h3>Register</h3>
<label for="txt-uName">User Name:</label>
<input type="text" name="uName" id="uName" value="">
<label for="txt-password">Password</label>
<input type="password" name="pWord" id="pWord" value="">
<a data-role="button" id="registerSubmit">Register</a>
<a id='lnkDialog' href="#dialog" data-rel="dialog" data-transition="pop" style='display:none;'></a>
</div>
</div>
and my javascript is:
$(document).on('click', '#registerSubmit', function(event){
username = $("#uName").val();
if (username.length < 5) {
$("#lnkDialog").click();
$("#text").html("Username Length too short");
} else if (username.length > 10) {
alert ("Username must be less than 5 charcters");
}else {
password = $("#pWord").val();
if (password.length < 5) {
alert ("Password must be greater than 5 charcters");
} else if (password.length > 10) {
alert ("Password must be less than 5 charcters");
} else {
//otherstuff
}
}
}
});