Skip to content Skip to sidebar Skip to footer

How To Get Or Record The Id Of A Element With The Current Focus For Later Retrieval Using Javascript

What i want is to save the html values and then display it with the previous function when the button called previous is clicked. However what i forgot to think about is that docum

Solution 1:

This depends on the type of element, if you want a textual representation of the HTML within the element, use innerHTML

document.getElementById("id").innerHTML

If you only want the text within the element and its descendants use textContent

document.getElementById("id").textContent

Finally if you're working with <input> elements you could use value

document.getElementById("id").value

Post a Comment for "How To Get Or Record The Id Of A Element With The Current Focus For Later Retrieval Using Javascript"