• Nikhil Shrigod 6
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
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?
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?