Title: Button click event
Last modified: August 22, 2019

---

# Button click event

 *  Resolved [stephenm](https://wordpress.org/support/users/stephenm/)
 * (@stephenm)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/button-click-event/)
 * Hi there…..how do you capture button click event in m jquery file??
 * this event wont capture the button even
 * jQuery.noConflict();
    (function ($) {
 *  function readyFn(i) {
    $(‘#fieldname4_1’).bind(‘click’,function() { alert(”);});}
   $(document).ready(readyFn); })(jQuery);
 * Can you help please?
 * S

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/button-click-event/#post-11857501)
 * Hello [@stephenm](https://wordpress.org/support/users/stephenm/)
 * Please, note that I’m the developer of the CFF plugin, and not for the jQuery
   framework, and your question is about how jQuery works.
 * At the moment your code is evaluated you cannot ensure the fieldname4_1 field
   exists in the form, so, probably the piece of code `$('#fieldname4_1')` returns
   no element.
 * There are two alternatives, you can to define your event in the bubbling process:
 *     ```
       jQuery(document).on('click', '#fieldname4_1', function(){ /* Your code here */ });
       ```
   
 * More information in the documentation of jQuery.
 * Or you can to define your function, for example:
 *     ```
       function my_code()
       {
       }
       ```
   
 * and then, if the fieldname4 is a button, call your function from its onclick 
   event (it is an attribute in the buttons’ settings):
 *     ```
       my_code();
       ```
   
 * and that’s all.
    Best regards.
 *  Thread Starter [stephenm](https://wordpress.org/support/users/stephenm/)
 * (@stephenm)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/button-click-event/#post-11859876)
 * Thanks so much for your reply….much appreciated.
 * S

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Button click event’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [stephenm](https://wordpress.org/support/users/stephenm/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/button-click-event/#post-11859876)
 * Status: resolved