Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 149914

ONCLientClick() posts back even when function returns false

$
0
0

I am trying to make it so an ASP:Button doesn't post back and refresh the page.

I have set OnClientClick to return false as the result of the function.

HTML -

<asp:Button ID="englishButton" runat="server" Text="English" OnClientClick="return englishClick();" />

JS -

function englishClick() {
            russianButton.style.backgroundColor = "WhiteSmoke";
            englishButton.style.backgroundColor = "teal";
            hebrewButton.style.backgroundColor = "WhiteSmoke";
            englishTable.style.visibility = "visible";
            hebrewTable.style.visibility = "hidden";
            russianTable.style.visibility = "hidden";
            return false;
        }

The style changes happen but then the page is immediately refreshed and the style returns to its original state.


Viewing all articles
Browse latest Browse all 149914

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>