<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
<div class="StateOneBtm">
<div class="h2">blah blah blah</div>
<div class="buttons">
<asp:TextBox ID="Email" runat="server" style="margin-left: 0px"
Width="272px" Height="28px" ForeColor="#CCCCCC"
onfocus="Onfoc();" ClientIDMode="Static">Enter your email...</asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Go"
CssClass="Button" Height="41px" onclick="Button1_Click" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="Email" ErrorMessage="!" ForeColor="Red"
ValidationExpression="\w+([-+.’]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
</div>
</div>
<script type="text/javascript" language="javascript">
function Onfoc() {
//document.getElementById('<%= Email.ClientID %>').value = "";
//document.getElementById('<%= Email.ClientID %>').style.color = "#000";
$('#Email').value = "";
$('#Email').addClass('EmailFocus');
}
</script>
</asp:Content>
Note that the textbox control with Id 'Email' has its onfocus event bound to the onFoc() function defined in the script.
Why won't this work? If I use the two lines that are commented out in the script it works just fine. When I try doing the same thing using jQuery it doesn't work. The EmailFocus css class is defined, and jQuery is included and everything.

New Topic/Question
Reply




MultiQuote




|