You need to sign in to do that
Don't have an account?
Nikhil Shrigod 6
Javascript problem
I have a problem with the following code:
<apex:page >
<apex:form >
<apex:commandButton value="Click" onclick="document.getElementById('sp').innerHTML='Hello'" />
<span id="sp"></span>
</apex:form>
</apex:page>
When I click on the button the value I am setting in the span tag ('Hello' in span) appears for 1 second and again disappears, I want the text 'Hello' to remain in span after clicking on the button. Can somebody please help me with this?
<apex:page >
<apex:form >
<apex:commandButton value="Click" onclick="document.getElementById('sp').innerHTML='Hello'" />
<span id="sp"></span>
</apex:form>
</apex:page>
When I click on the button the value I am setting in the span tag ('Hello' in span) appears for 1 second and again disappears, I want the text 'Hello' to remain in span after clicking on the button. Can somebody please help me with this?
You are almost there:
Try this:
Do you notice the rerender attribute set to span id?
Hope it helps
RD
All Answers
Please check below link may be it will helpful to you.
https://salesforce.stackexchange.com/questions/55191/problem-using-javascript-with-commandbutton
Regards,
Supriya Gore
You are almost there:
Try this:
Do you notice the rerender attribute set to span id?
Hope it helps
RD