On my website, there is a settings page where users can edit their profiles. After editing, they click the update button which triggers the updateProfileData
function. This works smoothly in Chrome browser, but in Firefox, the page reloads as soon as the button is pressed.
I want to prevent this automatic page reload in Firefox and ensure that the code runs successfully like it does in Chrome. How can I achieve this?
$('#update').on('click', event => {
updateProfileData();
})
function updateProfileData() {
// The code intended to run gets bypassed due to the page reloading
}
function pickFile() {
fileButton.click()
}
function pickFile2() {
fileButton2.click()
}
function openInNewTab(url) {
var win = window.open(url, '_blank');
win.focus();
}
html, body {
/* Styles here */
}
/* Additional CSS styles */
button {
/* Button styling */
}
/* More CSS rules */
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="topSignUpDiv">
<h1 class="">Edit profile/Settings</h1>
</div>
<div class="middleSignUpDiv">
<!-- HTML content -->
</div>