While working with HTML pages during design or prototyping, most of the times we have to access the HTML page elements and depending upon some user action values of those HTML elements can be manipulated. In this post, we will explore the ways to access different HTML elements while working with user data and manipulating the data assigned to them.
Here is a sample HTML page with text boxes defined for getting the user data
When we open this html page in browser, this is how it looks like:
Accessing data from text box
But, how do we identify the element Id. Well the easy way is just to look at the HTML document and copy the text box id. This process is simple when you have a very small HTML page.
But in case of complex and long HTML page, there is small utility inspect element(can be accessed by doing Right Click on HTML element) which is very helpful to identify the element details.
alert statement will give the following result