views:

33

answers:

2

Here's what I have so far but thing aren't really working. (I dragged the jQuery.js file from the Solution Explorer to the area of my html.

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SignUpFormTest._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            //fade in the context of whatever is inside the div tag.
            $('#name').fadeIn("slow");
        });
    </script>
</head>

<body bgcolor="#FFFFFF">

<p>
Note that this form doesn't actually do anything
except illustrate the Required Field Validator.
</p>

<form id="frmValidator" action="required.aspx" method="post" runat="server">

    Enter Your Name:
    <asp:TextBox id="txtName" runat="server" />
    <div id="name"><asp:RequiredFieldValidator id="valTxtName" ControlToValidate="txtName" ErrorMessage='<img src="../Images/no.png">' runat="server" /></div>

    <br />
    <asp:button id="btnSubmit" text="Submit" runat="server" />

</form>
<p>
Hint: Try submitting it before you enter something.
</p>
</body>


</html>

When validating the icon just pops up.

No fade in or anything. Also, I know my current solution is hacky, so I'd really like someone to tell me what I should do instead of a creating a DIV tag just for the purpose of one animation.

A: 
 $(document).ready(function() { 
document.getElementById('valTxtName').onpropertychange = function(){
            $('#name').fadeIn("slow"); 
}

}); 
Microgen
That still makes it just pop up.
Sergio Tapia
A: 

Make sure the reference to JQuery is valid and use this code:

$(document).ready(function() {
    $('#name').hide().fadeIn("slow");
});

If I'm not mistaken, since the div is already visible in your case, jQuery will not fade it in. The hide() method ensures that the div is initially not visible and then fades in slowly.

Lck