{"id":21917,"date":"2017-03-09T08:05:38","date_gmt":"2017-03-09T08:05:38","guid":{"rendered":"https:\/\/contactform7.com\/?page_id=21917"},"modified":"2017-12-03T04:48:56","modified_gmt":"2017-12-03T04:48:56","slug":"dom-events","status":"publish","type":"page","link":"https:\/\/contactform7.com\/ja\/dom-events\/","title":{"rendered":"DOM \u30a4\u30d9\u30f3\u30c8"},"content":{"rendered":"<p>Contact Form 7 \u306f\u6570\u7a2e\u985e\u306e\u30ab\u30b9\u30bf\u30e0 DOM \u30a4\u30d9\u30f3\u30c8\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u30a4\u30d9\u30f3\u30c8\u3092 JavaScript \u30b3\u30fc\u30c9\u5185\u3067\u4f7f\u7528\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u3001\u7279\u5b9a\u306e\u72b6\u6cc1\u3067\u95a2\u6570\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n<p>\u3053\u3053\u3067\u306f Contact Form 7 \u304c\u63d0\u4f9b\u3059\u308b DOM \u30a4\u30d9\u30f3\u30c8\u3001\u3069\u306e\u3088\u3046\u306a\u72b6\u6cc1\u3067\u305d\u308c\u3089\u306e\u30a4\u30d9\u30f3\u30c8\u304c\u767a\u751f\u3059\u308b\u304b\u3001\u307e\u305f\u3001\u30b3\u30fc\u30c9\u3067\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002DOM \u306e\u30a4\u30d9\u30f3\u30c8\u30e2\u30c7\u30eb\u306b\u95a2\u3059\u308b\u4e00\u822c\u7684\u306a\u8aac\u660e\u306f\u7701\u304d\u307e\u3059\u306e\u3067\u3001\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u5916\u90e8\u306e\u8cc7\u6599\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044:<\/p>\n<ul>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/DOM_events\">DOM events (Wikipedia)<\/a><\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/Guide\/Events\/Overview_of_Events_and_Handlers\">Overview of Events and Handlers (MDN)<\/a><\/li>\n<li><a href=\"https:\/\/www.w3.org\/TR\/DOM-Level-2-Events\/\">Document Object Model (DOM) Level 2 Events Specification<\/a><\/li>\n<\/ul>\n<h4>Contact Form 7 \u306e\u30ab\u30b9\u30bf\u30e0 DOM \u30a4\u30d9\u30f3\u30c8<\/h4>\n<ul>\n<li><strong><code>wpcf7invalid<\/code><\/strong> &#8212; Ajax \u306e\u30d5\u30a9\u30fc\u30e0\u9001\u4fe1\u304c\u5b8c\u4e86\u3057\u305f\u304c\u3001\u6b63\u3057\u304f\u306a\u3044\u5165\u529b\u304c\u3042\u3063\u305f\u305f\u3081\u306b\u30e1\u30fc\u30eb\u9001\u4fe1\u306f\u884c\u308f\u308c\u306a\u304b\u3063\u305f\u5834\u5408\u306b\u767a\u751f\u3059\u308b\u3002<\/li>\n<li><strong><code>wpcf7spam<\/code><\/strong> &#8212; Ajax \u306e\u30d5\u30a9\u30fc\u30e0\u9001\u4fe1\u304c\u5b8c\u4e86\u3057\u305f\u304c\u3001\u30b9\u30d1\u30e0\u884c\u70ba\u306e\u7591\u3044\u304c\u3042\u3063\u305f\u305f\u3081\u306b\u30e1\u30fc\u30eb\u9001\u4fe1\u306f\u884c\u308f\u308c\u306a\u304b\u3063\u305f\u5834\u5408\u306b\u767a\u751f\u3059\u308b\u3002<\/li>\n<li><strong><code>wpcf7mailsent<\/code><\/strong> &#8212; Ajax \u306e\u30d5\u30a9\u30fc\u30e0\u9001\u4fe1\u304c\u5b8c\u4e86\u3057\u3001\u307e\u305f\u30e1\u30fc\u30eb\u306e\u9001\u4fe1\u3082\u884c\u308f\u308c\u305f\u5834\u5408\u306b\u767a\u751f\u3059\u308b\u3002<\/li>\n<li><strong><code>wpcf7mailfailed<\/code><\/strong> &#8212; Ajax \u306e\u30d5\u30a9\u30fc\u30e0\u9001\u4fe1\u304c\u5b8c\u4e86\u3057\u305f\u304c\u3001\u30e1\u30fc\u30eb\u306e\u9001\u4fe1\u306b\u306f\u5931\u6557\u3057\u305f\u5834\u5408\u306b\u767a\u751f\u3059\u308b\u3002<\/li>\n<li><strong><code>wpcf7submit<\/code><\/strong> &#8212; \u4ed6\u306e\u6761\u4ef6\u306b\u95a2\u4fc2\u306a\u304f\u3001Ajax \u306e\u30d5\u30a9\u30fc\u30e0\u9001\u4fe1\u304c\u5b8c\u4e86\u3057\u305f\u5834\u5408\u306b\u767a\u751f\u3059\u308b\u3002<\/li>\n<\/ul>\n<h4>\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u30fc\u306e\u5b9f\u88c5<\/h4>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306f\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u30fc\u3092\u767b\u9332\u3059\u308b\u7c21\u5358\u306a\u4f8b\u3067\u3059\u3002\u3053\u306e\u4f8b\u3067\u306f\u3001\u95a2\u6570\u306f <code>wpcf7submit<\/code> \u30a4\u30d9\u30f3\u30c8\u306e\u901a\u77e5\u3092\u5f85\u3061\u3001\u30a4\u30d9\u30f3\u30c8\u767a\u751f\u6642\u306b\u306f\u30a2\u30e9\u30fc\u30c8\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar wpcf7Elm = document.querySelector( '.wpcf7' );\r\n\r\nwpcf7Elm.addEventListener( 'wpcf7submit', function( event ) {\r\n\talert( &quot;Fire!&quot; );\r\n}, false );\r\n<\/pre>\n<p>\u3053\u306e\u4f8b\u306b\u898b\u3089\u308c\u308b\u3088\u3046\u306b\u3001\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u30fc\u95a2\u6570\u306e\u767b\u9332\u306b\u306f <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/EventTarget\/addEventListener\"><code>addEventListener()<\/code><\/a> \u3092\u4f7f\u3044\u307e\u3059\u3002\u30a4\u30d9\u30f3\u30c8\u30bf\u30fc\u30b2\u30c3\u30c8 (\u4f8b\u4e2d\u3067\u306f <code>wpcf7Elm<\/code>) \u306f <code>form<\/code> \u8981\u7d20\u3067\u306f\u306a\u304f\u305d\u306e\u89aa\u306b\u3042\u305f\u308a <code>wpcf7<\/code> \u30af\u30e9\u30b9\u3092\u6301\u3064 <code>div<\/code> \u8981\u7d20\u3067\u3042\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><code>wpcf7*<\/code> \u30a4\u30d9\u30f3\u30c8\u306f\u3044\u305a\u308c\u3082 DOM \u30c4\u30ea\u30fc\u3092\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30eb\u30fc\u30c8\u306b\u5411\u304b\u3063\u3066\u30d0\u30d6\u30ea\u30f3\u30b0\u3059\u308b\u306e\u3067\u3001\u7279\u306b\u30a4\u30d9\u30f3\u30c8\u30bf\u30fc\u30b2\u30c3\u30c8\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u5834\u5408\u306b\u306f <code>document<\/code> \u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u30a4\u30d9\u30f3\u30c8\u30bf\u30fc\u30b2\u30c3\u30c8\u306b\u3059\u308b\u3053\u3068\u3067\u7c21\u7565\u5316\u3067\u304d\u307e\u3059:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\ndocument.addEventListener( 'wpcf7submit', function( event ) {\r\n\talert( &quot;Fire!&quot; );\r\n}, false );\r\n<\/pre>\n<p>\u5bfe\u8c61\u306e\u30b3\u30f3\u30bf\u30af\u30c8\u30d5\u30a9\u30fc\u30e0\u3078\u306e\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u30c7\u30fc\u30bf\u306f\u30a4\u30d9\u30f3\u30c8\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e <code>detail.inputs<\/code> \u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u3057\u3066\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u30fc\u306b\u6e21\u3055\u308c\u307e\u3059\u3002<code>detail.inputs<\/code> \u306e\u30c7\u30fc\u30bf\u69cb\u9020\u306f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u914d\u5217\u3067\u3042\u308a\u3001\u307e\u305f\u500b\u3005\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f <code>name<\/code> \u3068 <code>value<\/code> \u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u6301\u3061\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306e\u4f8b\u3067\u306f &#8220;your-name&#8221; \u5165\u529b\u9805\u76ee\u3078\u306e\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u5024\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3044\u307e\u3059:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\ndocument.addEventListener( 'wpcf7submit', function( event ) {\r\n\tvar inputs = event.detail.inputs;\r\n\r\n\tfor ( var i = 0; i &lt; inputs.length; i++ ) {\r\n\t\tif ( 'your-name' == inputs&#x5B;i].name ) {\r\n\t\t\talert( inputs&#x5B;i].value );\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}, false );\r\n<\/pre>\n<p>\u3053\u306e\u307b\u304b\u306b\u3082\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u30fc\u3067\u5229\u7528\u3067\u304d\u308b\u30a4\u30d9\u30f3\u30c8\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<table>\n<caption>\u5229\u7528\u53ef\u80fd\u306a\u30a4\u30d9\u30f3\u30c8\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30d7\u30ed\u30d1\u30c6\u30a3<\/caption>\n<tbody>\n<tr>\n<th>\u30d7\u30ed\u30d1\u30c6\u30a3<\/th>\n<th>\u8aac\u660e<\/th>\n<\/tr>\n<tr>\n<td>detail.contactFormId<\/td>\n<td>\u30b3\u30f3\u30bf\u30af\u30c8\u30d5\u30a9\u30fc\u30e0\u306e ID\u3002<\/td>\n<\/tr>\n<tr>\n<td>detail.pluginVersion<\/td>\n<td>Contact Form 7 \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3002<\/td>\n<\/tr>\n<tr>\n<td>detail.contactFormLocale<\/td>\n<td>\u30b3\u30f3\u30bf\u30af\u30c8\u30d5\u30a9\u30fc\u30e0\u306e\u30ed\u30b1\u30fc\u30eb\u30b3\u30fc\u30c9\u3002<\/td>\n<\/tr>\n<tr>\n<td>detail.unitTag<\/td>\n<td>\u30b3\u30f3\u30bf\u30af\u30c8\u30d5\u30a9\u30fc\u30e0\u306e\u30e6\u30cb\u30c3\u30c8\u30bf\u30b0\u3002<\/td>\n<\/tr>\n<tr>\n<td>detail.containerPostId<\/td>\n<td>\u30b3\u30f3\u30bf\u30af\u30c8\u30d5\u30a9\u30fc\u30e0\u304c\u7f6e\u304b\u308c\u3066\u3044\u308b\u6295\u7a3f\u306e ID\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f8b\u3048\u3070\u3001\u7279\u5b9a\u306e\u30b3\u30f3\u30bf\u30af\u30c8\u30d5\u30a9\u30fc\u30e0 (ID=123) \u306e\u307f\u306b\u5bfe\u3057\u3066\u4f55\u304b\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u6b21\u306e\u30b3\u30fc\u30c9\u306e\u3088\u3046\u306b <code>detail.contactFormId<\/code> \u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u4f7f\u3046\u3068\u3088\u3044\u3067\u3057\u3087\u3046:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\ndocument.addEventListener( 'wpcf7submit', function( event ) {\r\n\tif ( '123' == event.detail.contactFormId ) {\r\n\t\talert( &quot;The contact form ID is 123.&quot; );\r\n\t\t\/\/ do something productive\r\n\t}\r\n}, false );\r\n<\/pre>\n\n<h4>\u95a2\u9023\u9805\u76ee<\/h4>\n<blockquote class=\"wp-embedded-content\" data-secret=\"o7pyYiYKar\"><p><a href=\"https:\/\/contactform7.com\/ja\/faq\/dom-event-doesnt-work\/\">DOM \u30a4\u30d9\u30f3\u30c8\u304c\u6a5f\u80fd\u3057\u307e\u305b\u3093\u3002<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;DOM \u30a4\u30d9\u30f3\u30c8\u304c\u6a5f\u80fd\u3057\u307e\u305b\u3093\u3002&#8221; &#8212; Contact Form 7\" src=\"https:\/\/contactform7.com\/ja\/faq\/dom-event-doesnt-work\/embed\/#?secret=4S3TRhonAy#?secret=o7pyYiYKar\" data-secret=\"o7pyYiYKar\" width=\"474\" height=\"267\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Contact Form 7 \u306f\u6570\u7a2e\u985e\u306e\u30ab\u30b9\u30bf\u30e0 DOM \u30a4\u30d9\u30f3\u30c8\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u30a4\u30d9\u30f3\u30c8\u3092 JavaScript \u30b3\u30fc\u30c9\u5185\u3067\u4f7f\u7528\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u3001\u7279\u5b9a\u306e\u72b6\u6cc1\u3067\u95a2\u6570\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002 \u3053\u3053\u3067\u306f Cont &hellip; <a href=\"https:\/\/contactform7.com\/ja\/dom-events\/\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">DOM \u30a4\u30d9\u30f3\u30c8<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_locale":"ja","_original_post":"21911","footnotes":""},"class_list":["post-21917","page","type-page","status-publish","hentry","ja"],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/contactform7.com\/wp-json\/wp\/v2\/pages\/21917","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contactform7.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/contactform7.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/contactform7.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contactform7.com\/wp-json\/wp\/v2\/comments?post=21917"}],"version-history":[{"count":0,"href":"https:\/\/contactform7.com\/wp-json\/wp\/v2\/pages\/21917\/revisions"}],"wp:attachment":[{"href":"https:\/\/contactform7.com\/wp-json\/wp\/v2\/media?parent=21917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}