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
- What is TypeScript and why would I use it in place of JavaScript? [closed]
- How to do associative array/hashing in JavaScript
- How to play audio?
- How to write a countdown timer in JavaScript?
- TypeScript foreach return [duplicate]
- how to render a react component using ReactDOM Render
- What does “javascript:void(0)” mean?
- What does this symbol mean in JavaScript?
- Go back button in a page
- ‘react-scripts’ is not recognized as an internal or external command
- Set timeout for ajax (jQuery)
- Escaping Discord subset of markdown
- ESLint Parsing error: Unexpected token
- Angular ForEach in Angular4/Typescript?
- Timers in React Native (this.setTimeout)
- CSS height 100% percent not working
- Angular 4 setting selected option in Dropdown
- XMLHttpRequest module not defined/found
- Bower: ENOGIT Git is not installed or not in the PATH
- Converting an object to a string
- Function not defined javascript
- The preferred way of creating a new element with jQuery
- How to pass parameters using ui-sref in ui-router to controller
- Add and remove multiple classes in jQuery
- How To Save Canvas As An Image With canvas.toDataURL()?
- NPM install fails with node-gyp
- What are differences between SystemJS and Webpack?
- How to find if div with specific id exists in jQuery?
- TypeError: $ is not a function WordPress
- Fully responsive HTML5 video
- Make Discord bot send picture with message with NodeJS
- RegEx for Javascript to allow only alphanumeric
- How to check for an undefined or null variable in JavaScript?
- HTML anchor link – href and onclick both?
- Remove extra Google Maps script
- Using filter to add additional fields to comment_form()
- initial open/toggle PluginDocumentSettingPanel panel in document setting block editor gutenberg
- How to add JavaScript code on WordPress properly?
- Restrict file types in the uploader of a wp.media frame
- Gutenberg getMedia() in post query doesn’t return all featured images
- Can I change an external script’s HTML?
- How to transform a legacy widget into a block
- const { __ } not working in IE11
- Adding and removing hidden buttons from WordPress Customizer Tinymce widget editor using javascript API
- Cannot use characters ” in jQuery script in WordPress
- How to install cool javascript feature in WordPress?
- How can I load certain JavaScripts only on blog pages?
- jQuery UI Tools (Flowplayer) Issues
- How do I know if I should enqueue JS code or just include it in ONE PHP function?
- print script on wordpress header after user registered
- How do I use this javascript correct with wordpress?
- How can I integrate yepnope.js with WordPress (and plugins)?
- Testing a Form’s Zipcode Field with Regular Expressions to Determine WordPress Page Behaviour
- How to set javascript options for select2 in PHP array of plugin
- Multiple jQuery inputs or binds in Customizer Control Javascripts
- How to display different content on the same page using different URLS
- Immediate (e.g. without DOMContentLoaded) JS not working
- Client side pre-save Javascript hook on all admin pages
- WP Gutenberg – custom block with two content fields
- How to identify which javascript is being executed
- How to keep close a sub-menu under homepage? [closed]
- How to implement custom URL handler to access JS modal content? [closed]
- Contact form 7 hide and show fields depending up on the condition [closed]
- Javascript 2 elements dependent onclick .toggle [closed]
- wp_enqueue has a resource but doesn’t generate a script tag [duplicate]