Click here to Skip to main content
11,504,892 members (70,730 online)
Rate this: bad
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#


/*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
0 F-ES Sitecore 315
1 Sergey Alexandrovich Kryukov 273
2 CHill60 195
3 OriginalGriff 185
4 Richard Deeming 180
0 Sergey Alexandrovich Kryukov 723
1 Peter Leow 490
2 Maciej Los 475
3 DamithSL 470
4 OriginalGriff 437

Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 13 Sep 2012
Copyright © CodeProject, 1999-2015
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