asp.net - javascript - get value of a text box that contains a date? -
this question has answer here:
i have text box date (gotten date picker) , trying value of text box using javascript. reason function returning null or errs.can me?
<asp:textbox id="txtstartdate" name="txtstartdate" runat="server" maxlength="100" causesvalidation="true" validationgroup="priorauth" cssclass="effect"></asp:textbox> <ajaxtoolkit:calendarextender id="cestartdate" runat="server" format="mm/dd/yyyy" popupbuttonid="imagebutton1" targetcontrolid="txtstartdate" popupposition="bottomright" /> alert("date: " + date.parse(document.getelementsbyname('txtstartdate').value)); var startdate = date.parse(document.getelementsbyname('txtstartdate').value);
one thing is: getelementsbyname
should return array of elements
point whichever index makes sense:
document.getelementsbyname('txtstartdate')[0].value
or use getelementbyid
Comments
Post a Comment