Click here to Skip to main content
12,894,249 members (69,932 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET Javascript HTML
what i could get information from html in javascript?
for example i want get data from html in textbox of language c#

<javascript language="javascript">
/*i want get information in control by name txtdata */


<asp:textbox id="txtdata" runat="server" />
Posted 12-Sep-12 10:13am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

try this in Javascript
var textBoxvalue = document.getElementById("txtdata");
<asp:textbox id="txtdata" runat="server" xmlns:asp="#unknown" />
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This is one of main purposes of JavaScript. For example, you can get an input control object using getElementById and then use its property value. In case of text input, it will be the text in the text box. Please see:[^],[^].

Starting from any element, you can also get the whole DOM model of the whole document of its part. Please start here:[^],[^].

It's more convenient to work with HTML DOM elements using jQuery:[^],[^].

For example, this is the equivalent of getElementById:
inputElement = $("#myTextBox"); // element wrapper, found by the id selector, if the element has the attribute id="myTextBox"
value = inputElement.val(); // use this wrapper
Please see:[^],[^],[^].

Major DOM navigation is done using traversing methods:[^].

If you need to learn jQuery, start here:[^],[^].


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170424.1 | Last Updated 13 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100