firstChild and hasAttribute
I'm starting to learn jQuery by doing examples in a book.
IE 9
jquery-1.9.1.min.js
I have this in my Site.master
<script type="text/javascript" src="Scripts/jquery-1.9.1.min.js"></script>
The jquery file is in the Scripts folder.
I'm fairly sure that the jquery file is found b/c if I change it to anything but the above it will not run and have a $ is not defined.
Here is my code that is not working. When I click the button on the page it hits my break point inside the click function.
However I get a "Object does not support property or method hasAttribute".
If I have:
$("email_error").firstChild.nodeValue = "Entry is invalid.";
uncommentted I get firstChild is undefined.
$("email_error") and var b are both defined.
What is causing this?
- <%
@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"CodeFile="Default.aspx.cs" Inherits="_Default" %><asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"><script type="text/javascript">$(document).ready(function () {$("input[id$=join_list]").click(function () {// $("email_error").firstChild.nodeValue = "Entry is invalid."; var b = $("input[id$=join_list]");if (b.hasAttribute("value")) {var valAttr = b.getAttribute("value");}});});</script></asp:Content><asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"><label for="email_addresss">Email Address:</label><input type = "text" id="email_address" /><span id="email_error">*</span><br /><label> </label><input type="button" id="join_list" value="Join our List" /></asp:Content>