javascript - Why does null keep coming back when getting nodeValue even though it displays properly? -
This is driving me crazy I'm going to insert code into a page via Ajax code after I put a Running a function to capture the text of the div and am displaying it on the page in another place.
Can anyone tell me why I am saying a javascript error that This is the code that is receiving text value, which is inserted through Ajax in the main page: How it looks: The problem you have is that Change ... current text is zero, even if the text is displayed properly in the second place in the page ??
var currentText = document.getElementById ("current-text"), updated text = Document.getElementById ("update-text-here"); UpdatedTextHere.innerHTML = currentText.firstChild.nodeValue;
getDate = function {var currentText = document.getElementById (" Current -text "), updated text = document. GetElementById (" update-text-here "); UpdatedTextHere.innerHTML = currentText.firstChild.nodeValue; }, Htmlready = function () {myDiv.innerHTML = xmlRequest.responseText; get Date(); },
firstChild This is not a node of
currentText . Your
nodeValue is not a value because it does not exist, instead you should use the
innerHTML or
textContent .
updatedTextHere.innerHTML = currentText. FirstChild.textContent; // or internal HTML
Comments
Post a Comment