This is happening because the entire comment edit page is inside a <form>
element, and the <button>
element submits any form that it belongs to. This is the normal behaviour of buttons in HTML.
If you don’t want a button to act as a submit button, you need to set the type
attribute to button
:
<button class="ed_button button button-small" onclick="copy_civicrm_subject_code()" type="button">
Copy
</button>
The default type
attribute for a button is submit
, which is why it behaves that way unless you set it to button
.
Related Posts:
- How to load javascript file on homepage in WordPress in order?
- Reactjs – Form input validation
- Angular: mat-form-field must contain a MatFormFieldControl
- No value accessor for form control
- Send POST data using XMLHttpRequest
- Setting onSubmit in React.js
- jQuery AJAX submit form
- How to reset a form using jQuery with .reset() method
- JavaScript post request like a form submit
- How to create a HTML Cancel button that redirects to a URL
- What does ngf-select do and why is it needed for form validation?
- JavaScript post request like a form submit
- How can I get form data with JavaScript/jQuery?
- {“error”: “Please use POST request”} – alternative solution to submitting a form
- FormData append not working
- JavaScript code to stop form submission
- how to write javascript code inside php
- ngular is automatically adding ‘ng-invalid’ class on ‘required’ fields
- Add custom form to theme
- How to replace a javascript select box onchange event to a form submit action?
- How do I embed a Javascript form directly into a page?
- How do you filter the list of states when country is selected? [closed]
- Uncaught ReferenceError: jQuery is not defined – although jQuery is loaded [closed]
- How to add “on change” to a text input in contact form7?
- Add captcha validation to my custom form for Frontend posting
- How to add a onclick attribute to a list of checkboxes?
- Close modal window after form submit [closed]
- Form will not popup, when clicking on the link to the form
- How to show cities according to the state in Form using Javascript? [closed]
- Can’t Listen to KeyDown in TInyMCE Iframe (jQuery) and Pass it to Parent HTML FORM
- Error handling for wpdb error – displaying an error message to the user
- How to change number field to text field using JS
- CCF7 Field numbuer prefilled after Click event
- Get Comment Text via REST API
- Sending GravityForms to custom HTML
- Testing a Form’s Zipcode Field with Regular Expressions to Determine WordPress Page Behaviour
- Comment form in wordpress theme returns a javascript alert
- Facebook fanbox problem
- Bootstrap bundle present in page source but not working
- How t Remove Labels from comment Box
- Gutenberg – useEffect manipulate DOM after block re-renders DOM
- Show a popup message when file is uploaded
- How to display contact form 7 form in vanilla js without jquery in frontend
- Append html to div
- Change each text after 4 second and each image after 2 second
- wp_handle_upload returns a critical error response or invalid form submission
- Hook a script as the very last one before the closing body tag
- Problem extending a core block
- How to import a JavaScript Library into WordPress
- how to let users upload their custom cover image
- imporing HTML+javascript from REST API
- how to use nimble-API and Display data?
- How do I add tags to entire comments, not just their text
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- Dynamically add Js
- JS / jQuery in Elementor pages vs JS file
- Script widget works only in admin view but not in Public
- Uncaught TypeError: switchEditors.switchto is not a function
- Load JavaScript on specific page with @wordpress compiler
- Cannot read properties of undefined (reading ‘show_ui’) Error on WordPress Post Editor
- Cascading dropdown select search based on Parent Page & Child Page
- How WP does Mortgage affordability calculation
- onclick not working since move from HTML to WP
- How to set javascript options for select2 in PHP array of plugin
- create timestamp links to jump to specific times on rumble videos
- Putting custom html/js page into Elementor as it’s own block
- Add Paypal button redirect to a specific page after completing
- Multiple jQuery inputs or binds in Customizer Control Javascripts
- wp post_tag change minlength
- How to get file object from file_attachment?
- How to load Javascript code or functions.php later in a child theme?
- google pie chart in wordpress
- How to locate the js code and php code for certain function?
- How to validate image with specific height and width selection in media selector
- Modal won’t appear on all pages
- How to change the link address from internal to external
- How do you create your own link preview for my website?
- Can’t get rid of JQMIGRATE: Migrate is installed, version 3.3.2. Manually updated all the libralies and site. 5.8.2
- how to add a custom javascript file to our theme
- Script only works on wordpress home page & only when Jqurery is aded using
- how to prevent added meta box from being injected with style=”position: fixed; top: 56px;” at scroll down
- I want to make a post api call once a post or page is published/updated and show a javascript alert box saying ‘Post has been published/updated’
- download svg to png size image
- Add a Page Screen is Visually Blank
- Taxonomy Template displaying different color post tag js
- Debugging JS errors
- Check if user can in javascript
- Javascript File Does Not Work
- login form should redirect to register page for in 1st login next time it should redirected to home page
- JS inside modal doesn’t work
- How to Get Post Meta in .Js File [duplicate]
- My code will not execute in wordpress, even though I’ve been told the code is fine
- Drag-to-Scroll Landingpage
- wp-api Backbone JS Client fetch options
- How to display different content on the same page using different URLS
- Easiest way to find JS conflicts
- Save in localstorage and db and show it later
- Web cover page open when button clicked
- internal anchor links no longer working after upgrade
- Deferring Script wp-i18n causes a console error ‘wp is not defined’ – Gravityforms