[resolved] Adding Content to IDs
Hi,
I'm trying to add some content to an id and I'm having a really hard time. I can prepend to the body or other built in tags, but not to IDs or Classes. I'm trying to scrub a form with jquery. The checks in my code all work. I just cannot get content to appear near an id or class. Here is my code/html:
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="styles/base.css" rel="stylesheet" type="text/css" />
<script src="jquery/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
function emailTest(data) {
if(/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9]+$/.test(data)){
return 0;
}else{return 1;}
}
function process(){
/*PROCESS SIGN UP FORM INOFORMATION*/
var email = $('#email').val();
var emailPattern = emailTest(email);
var username = $('#username').val();
var pass = $('#pass').val();
var repass = $('#repass').val();
//CHECK INDIVIDUAL FIELDS
if(email.length == 0){
$('#email').prepend('You must enter email.');
}else{
if(emailPattern == 0){
$('#email').prepend('kosher');
}$('#email').prepend('boo again');}
}
}
</script>
</head>
<body>
<div id="signUp">
<div class="top"></div>
<div id="windowBody">
<h2 class="header">Create An Account</h2>
<div class="spacer"></div>
<form>
<h2>Email</h2>
<input type="text" name="email" id="email"/>
<h2>Desired Username</h2>
(6-15 Non-Special Characters)
<input type="text" name="username" id="username" />
<h2>Password</h2>
(6-15 Non-Special Characters)
<input type="password" name="pass" id="pass" />
<h2>Password Again</h2>
<input type="password" name="repass" id="repass"/>
<input type="submit" onmousedown="process();" name="submit" value="submit" />
</form>
</div>
<div class="bottom"></div>
</div>
</body>
</html>
Thanks. I appreciate the help.