You need to sign in to do that
Don't have an account?
PRIYAN NEERUDU
priyan
m trying to add two input textvalues using javascript ...but using below code m unable to do....how i can get dis functioanlity done
-------------------------------------------------------------------------
<apex:page >
<apex:form >
<p id="demo"></p>
<apex:inputText id="txt1"/>
<apex:inputText id="txt2"/>
<script>
function myFunction() {
var y = document.getElementById("txt1").value;
var z = document.getElementById("txt2").value;
var x = y + z;
document.getElementById("c").innerHTML = x;
}
</script>
<p id="demo"></p>
<apex:pageBlock >
<apex:pageBlockButtons location="bottom">
<apex:commandButton onclick="sum()" value="sum"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
-------------------------------------------------------------------------
<apex:page >
<apex:form >
<p id="demo"></p>
<apex:inputText id="txt1"/>
<apex:inputText id="txt2"/>
<script>
function myFunction() {
var y = document.getElementById("txt1").value;
var z = document.getElementById("txt2").value;
var x = y + z;
document.getElementById("c").innerHTML = x;
}
</script>
<p id="demo"></p>
<apex:pageBlock >
<apex:pageBlockButtons location="bottom">
<apex:commandButton onclick="sum()" value="sum"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Please try below code, this is working as expected in my org.
If this works for you, please mark it best answer or let me know if you face issues in it.
Thanks,
Gaurav
Email: gauravgarg.nmims@gmail.com