1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Add Action to Submit button |
---|
4 | Version: 0.1 |
---|
5 | Plugin URI: http://yoast.com/wordpress/ |
---|
6 | Description: |
---|
7 | Author: Joost de Valk |
---|
8 | Author URI: http://yoast.com/ |
---|
9 | */ |
---|
10 | |
---|
11 | function add_action_to_submit($buffer, $args) { |
---|
12 | $buffer .= '<script type="text/javascript" charset="utf-8"> |
---|
13 | jQuery(document).ready(function() { |
---|
14 | jQuery(\'#'.$args['id_form'].'\').submit(function(){ |
---|
15 | alert(\'Handler for .submit() called.\'); |
---|
16 | return false; |
---|
17 | }); |
---|
18 | }); |
---|
19 | </script>'; |
---|
20 | return $buffer; |
---|
21 | } |
---|
22 | add_filter('comment_form_output','add_action_to_submit',10,2); |
---|
23 | |
---|
24 | wp_enqueue_script('jquery'); |
---|
25 | ?> |
---|