WordPress.org

Make WordPress Core

Ticket #12564: test-comment.php

File test-comment.php, 574 bytes (added by joostdevalk, 4 years ago)

Plugin to test last patch.

Line 
1<?php
2/*
3Plugin Name: Add Action to Submit button
4Version: 0.1
5Plugin URI: http://yoast.com/wordpress/
6Description:
7Author: Joost de Valk
8Author URI: http://yoast.com/
9*/
10
11function 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}
22add_filter('comment_form_output','add_action_to_submit',10,2);
23
24wp_enqueue_script('jquery');
25?>