[jQuery] [validate] jquery validation problem
hi,
i new to jquery, i'm using the jquery validation to validate my form.
using this code
<script src="includes/jquery/jquery.validate.js" type="text/
javascript"></script>
<script src="includes/jquery/cmxforms.js" type="text/javascript"></
script>
<script type="text/javascript">
$.validator.setDefaults({
submitHandler: function() { alert("submitted!"); }
});
$().ready(function() {
$("#addrest").validate({
rules: {
restname: "required"
},
messages: {
restname: "
<font face=\"Arial\" style=\"font-size: 9pt\" color=
\"#96A26F\">Please enter your Restaurant Name</font>"
}
});
});
$(document).ready(function() {
$('#yes').click(function(){
$('#tr').hide();
});
$('#no').click(function(){
$('#tr').show();
});
});
</script><script src="includes/jquery/jquery.validate.js" type="text/
javascript"></script>
<script src="includes/jquery/cmxforms.js" type="text/javascript"></
script>
<script type="text/javascript">
$.validator.setDefaults({
submitHandler: function() { alert("submitted!"); }
});
$().ready(function() {
$("#addrest").validate({
rules: {
restname: "required"
},
messages: {
restname: "
<font face=\"Arial\" style=\"font-size: 9pt\" color=
\"#96A26F\">Please enter your Restaurant Name</font>"
}
});
});
$(document).ready(function() {
$('#yes').click(function(){
$('#tr').hide();
});
$('#no').click(function(){
$('#tr').show();
});
});
</script>
its working fine under IE7 but when i press the submit button again on
FF or opera the message appears under the old message so i would have
two messages saying "this is required..." under each other. this keeps
happening every time i press the submit button.
how can i make the message show only once no matter how many times the
submit button is pressed?
thx