javascript get text from paragraph
function getContent() {
return document.getElementById("myParagraph").innerHTML;
}
javascript get text from paragraph
function getContent() {
return document.getElementById("myParagraph").innerHTML;
}
get text from html string javascript
<input id="input" />
<div id="div" contenteditable="true">Text in DIV</div>
<p id="p" contenteditable="true">Text in paragraph</p>
<script type="text/javascript">
// function to get text from HTML element
function getText(id) {
// if element is input then return the value
if (document.getElementById(id).nodeName === "INPUT") {
return document.getElementById(id).value;
}
// otherwise return the textContent
return document.getElementById(id).textContent;
}
// print the current values
console.log(getText("div"));
console.log(getText("p"));
</script>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us