I already tested with 2 inputText, It runs well for example
var tdate = document.getElementById('txtDate'); //h:inputText
var tdt = document.getElementById('txtDateTime'); //h:inputText
tdate.onchange = function(){
tdt.value = tdate.value;
};
How can I change the value of " tdt " - h:outputText?
var tdate = document.getElementById('txtDate'); //h:inputText
var tdt = document.getElementById('txtDateTime'); //h:outputText
Look in the generated HTML source. Rightclick page in browser and view source. You'll see that the <h:outputText>
renders a HTML <span>
element with the value in its body. To alter the body of a <span>
in JavaScript you need to manipulate the innerHTML
.
tdt.innerHTML = "new value";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With