hello, i want to know to get the value from a calculated value in text area with java script. i used the getelementByid with the id of my div and when i used alert(div.innerText) it showed nothing
Hello Jonathan. Sometimes the calc value renders asynchronously. You can put a timeout to let the value make the appropriate calculation a moment. setTimeout(()=>{alert(div.InnerText)},1500) //wait 1.5 seconds Another ways is to detect when the calc value changes is by monitorin changes throung a MutationObserver: function myCallback(){ console.log(div.innerText) } observer = new MutationObserver(myCallback); observer.observe(div,{childList:true,subtree :true})
Love these "JavaScript" stuff in Spotfire!
Please keep them coming. Thank You!
hello, i want to know to get the value from a calculated value in text area with java script. i used the getelementByid with the id of my div and when i used alert(div.innerText) it showed nothing
Hello Jonathan.
Sometimes the calc value renders asynchronously. You can put a timeout to let the value make the appropriate calculation a moment.
setTimeout(()=>{alert(div.InnerText)},1500) //wait 1.5 seconds
Another ways is to detect when the calc value changes is by monitorin changes throung a MutationObserver:
function myCallback(){
console.log(div.innerText)
}
observer = new MutationObserver(myCallback);
observer.observe(div,{childList:true,subtree :true})
Great Information but please slow down. Give some time for audience to follow.