-1

On click of a button, I want to prevent postback so that the page does not refresh. I tried with below but doesn't prevent from postback. Any help?

<div>
    <button type="button" onclick="return false">Save</button>
</div>

Note: I cannot (rather I am not using) use VF page for this. I am using the html inside the resource bundle and trying to make changes in it.

2

1 Answer 1

0

I would suggest using a VisualForce page with VF controls. You can use a commandButton and use the rerender attribute to cause only a partial page reload. At the very least, you would want to show a message giving some feedback to the user.

<apex:commandButton action="{!yourActionHere}" reRender="<id of the object to rerender>"
    value="Save"/>
3
  • no, i cannot use the apex command here due to the complex folder structure which has html & JS files in it. what if i want to go without apex tag?
    – Viraj
    Commented Jan 6, 2016 at 13:24
  • Understood. It could be good to clarify in the question that you cannot use VisualForce for this :)
    – mkorman
    Commented Jan 6, 2016 at 13:27
  • 1
    Done, i have updated the question for clear view. sorry.
    – Viraj
    Commented Jan 6, 2016 at 13:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .