{"id":246,"date":"2019-08-14T12:19:21","date_gmt":"2019-08-14T12:19:21","guid":{"rendered":"https:\/\/www.webhozz.com\/code\/?p=246"},"modified":"2019-09-03T10:49:31","modified_gmt":"2019-09-03T10:49:31","slug":"jquery-callback","status":"publish","type":"post","link":"https:\/\/www.webhozz.com\/code\/jquery-callback\/","title":{"rendered":"jQuery : Callback"},"content":{"rendered":"\n<h5 class=\"wp-block-heading\">Fungsi Callback jQuery<\/h5>\n\n\n\n<p>Pernyataan JavaScript dieksekusi baris demi baris. Tapi,\nkarena efek jQuery membutuhkan waktu untuk menyelesaikan kode baris berikutnya\nakan dieksekusi saat efek sebelumnya masih berjalan. Untuk mencegah hal ini\nterjadi, jQuery menyediakan callback function untuk setiap metode efek.<\/p>\n\n\n\n<p>Callback function adalah fungsi yang dieksekusi setelah efeknya selesai. Callback function diteruskan sebagai argumen ke metode efek dan mereka biasanya muncul sebagai argumen terakhir dari metode. Misalnya, sintaks dasar metode efek jQuery <strong><em>slideToggle()<\/em><\/strong> dengan callback function dapat diberikan dengan:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n&lt;script type=&quot;text\/javascript&quot;&gt;\n$(document).ready(function(){\n    $(&quot;button&quot;).click(function(){\n        $(&quot;p&quot;).slideToggle(&quot;slow&quot;);\n        alert(&quot;The slide toggle effect has completed.&quot;);\n    });   \n});\n&lt;\/script&gt;\n<\/pre><\/div>\n\n\n<p>Dan, inilah versi modifikasi dari contoh sebelumnya di mana kita telah menempatkan pernyataan <strong><em>alert()<\/em><\/strong> di dalam <em>callback function<\/em> pada metode <strong><em>slideToggle()<\/em><\/strong>. Jika kalian mencoba kode ini, pesan peringatan akan ditampilkan setelah efek slide toggle selesai.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n&lt;script type=&quot;text\/javascript&quot;&gt;\n$(document).ready(function(){\n    $(&quot;button&quot;).click(function(){\n        $(&quot;p&quot;).slideToggle(&quot;slow&quot;, function(){\n            \/\/ Code to be executed once effect is complete\n            alert(&quot;The slide toggle effect has completed.&quot;);\n        });\n    });   \n});\n&lt;\/script&gt;\n<\/pre><\/div>\n\n\n<p>Demikian pula, kalian dapat menentukan <em>callback function<\/em> untuk metode efek jQuery lainnya, seperti <strong><em>show(), hide(), fadeIn(), fadeOut(), animate()<\/em><\/strong>, dll.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n&lt;script type=&quot;text\/javascript&quot;&gt;\n$(document).ready(function(){\n    $(&quot;button&quot;).click(function(){\n        $(&quot;h1, p&quot;).slideToggle(&quot;slow&quot;, function(){\n            \/\/ Code to be executed once effect is complete\n            alert(&quot;The slide toggle effect has completed.&quot;);\n        });\n    });   \n});\n&lt;\/script&gt;\n<\/pre><\/div>\n\n\n<p>Jika kalian mencoba kode contoh di atas, itu akan\nmenampilkan pesan peringatan yang sama dua kali per elemen <strong><em>&lt;h1&gt;<\/em><\/strong> dan <strong><em>&lt;p&gt;<\/em><\/strong>,\nsetelah mengklik tombol pemicunya.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fungsi Callback jQuery Pernyataan JavaScript dieksekusi baris demi baris. Tapi, karena efek jQuery membutuhkan waktu untuk menyelesaikan kode baris berikutnya akan dieksekusi saat efek sebelumnya<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-246","post","type-post","status-publish","format-standard","hentry","category-jquery"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Belajar jQuery : Callback - WebHozz Code<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhozz.com\/code\/jquery-callback\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Belajar jQuery : Callback - WebHozz Code\" \/>\n<meta property=\"og:description\" content=\"Fungsi Callback jQuery Pernyataan JavaScript dieksekusi baris demi baris. Tapi, karena efek jQuery membutuhkan waktu untuk menyelesaikan kode baris berikutnya akan dieksekusi saat efek sebelumnya\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhozz.com\/code\/jquery-callback\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHozz Code\" \/>\n<meta property=\"article:published_time\" content=\"2019-08-14T12:19:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-09-03T10:49:31+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/jquery-callback\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/jquery-callback\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/#\\\/schema\\\/person\\\/3b2b79dc317236b0dde4b1fda37263e1\"},\"headline\":\"jQuery : Callback\",\"datePublished\":\"2019-08-14T12:19:21+00:00\",\"dateModified\":\"2019-09-03T10:49:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/jquery-callback\\\/\"},\"wordCount\":164,\"articleSection\":[\"jQuery\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/jquery-callback\\\/\",\"url\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/jquery-callback\\\/\",\"name\":\"Belajar jQuery : Callback - WebHozz Code\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/#website\"},\"datePublished\":\"2019-08-14T12:19:21+00:00\",\"dateModified\":\"2019-09-03T10:49:31+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/#\\\/schema\\\/person\\\/3b2b79dc317236b0dde4b1fda37263e1\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/jquery-callback\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.webhozz.com\\\/code\\\/jquery-callback\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/jquery-callback\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"jQuery : Callback\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/#website\",\"url\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/\",\"name\":\"WebHozz Code\",\"description\":\"Tutorial Web &amp; Pemrograman Indonesia\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/#\\\/schema\\\/person\\\/3b2b79dc317236b0dde4b1fda37263e1\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f222cb0ed38f2100d666bb262fd38d4f0d8e5673698208e40ff83118f10a4e8e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f222cb0ed38f2100d666bb262fd38d4f0d8e5673698208e40ff83118f10a4e8e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f222cb0ed38f2100d666bb262fd38d4f0d8e5673698208e40ff83118f10a4e8e?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"url\":\"https:\\\/\\\/www.webhozz.com\\\/code\\\/author\\\/dody\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Belajar jQuery : Callback - WebHozz Code","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webhozz.com\/code\/jquery-callback\/","og_locale":"en_US","og_type":"article","og_title":"Belajar jQuery : Callback - WebHozz Code","og_description":"Fungsi Callback jQuery Pernyataan JavaScript dieksekusi baris demi baris. Tapi, karena efek jQuery membutuhkan waktu untuk menyelesaikan kode baris berikutnya akan dieksekusi saat efek sebelumnya","og_url":"https:\/\/www.webhozz.com\/code\/jquery-callback\/","og_site_name":"WebHozz Code","article_published_time":"2019-08-14T12:19:21+00:00","article_modified_time":"2019-09-03T10:49:31+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webhozz.com\/code\/jquery-callback\/#article","isPartOf":{"@id":"https:\/\/www.webhozz.com\/code\/jquery-callback\/"},"author":{"name":"admin","@id":"https:\/\/www.webhozz.com\/code\/#\/schema\/person\/3b2b79dc317236b0dde4b1fda37263e1"},"headline":"jQuery : Callback","datePublished":"2019-08-14T12:19:21+00:00","dateModified":"2019-09-03T10:49:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhozz.com\/code\/jquery-callback\/"},"wordCount":164,"articleSection":["jQuery"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.webhozz.com\/code\/jquery-callback\/","url":"https:\/\/www.webhozz.com\/code\/jquery-callback\/","name":"Belajar jQuery : Callback - WebHozz Code","isPartOf":{"@id":"https:\/\/www.webhozz.com\/code\/#website"},"datePublished":"2019-08-14T12:19:21+00:00","dateModified":"2019-09-03T10:49:31+00:00","author":{"@id":"https:\/\/www.webhozz.com\/code\/#\/schema\/person\/3b2b79dc317236b0dde4b1fda37263e1"},"breadcrumb":{"@id":"https:\/\/www.webhozz.com\/code\/jquery-callback\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhozz.com\/code\/jquery-callback\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhozz.com\/code\/jquery-callback\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhozz.com\/code\/"},{"@type":"ListItem","position":2,"name":"jQuery : Callback"}]},{"@type":"WebSite","@id":"https:\/\/www.webhozz.com\/code\/#website","url":"https:\/\/www.webhozz.com\/code\/","name":"WebHozz Code","description":"Tutorial Web &amp; Pemrograman Indonesia","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhozz.com\/code\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.webhozz.com\/code\/#\/schema\/person\/3b2b79dc317236b0dde4b1fda37263e1","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f222cb0ed38f2100d666bb262fd38d4f0d8e5673698208e40ff83118f10a4e8e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f222cb0ed38f2100d666bb262fd38d4f0d8e5673698208e40ff83118f10a4e8e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f222cb0ed38f2100d666bb262fd38d4f0d8e5673698208e40ff83118f10a4e8e?s=96&d=mm&r=g","caption":"admin"},"url":"https:\/\/www.webhozz.com\/code\/author\/dody\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhozz.com\/code\/wp-json\/wp\/v2\/posts\/246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webhozz.com\/code\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhozz.com\/code\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhozz.com\/code\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhozz.com\/code\/wp-json\/wp\/v2\/comments?post=246"}],"version-history":[{"count":2,"href":"https:\/\/www.webhozz.com\/code\/wp-json\/wp\/v2\/posts\/246\/revisions"}],"predecessor-version":[{"id":346,"href":"https:\/\/www.webhozz.com\/code\/wp-json\/wp\/v2\/posts\/246\/revisions\/346"}],"wp:attachment":[{"href":"https:\/\/www.webhozz.com\/code\/wp-json\/wp\/v2\/media?parent=246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhozz.com\/code\/wp-json\/wp\/v2\/categories?post=246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhozz.com\/code\/wp-json\/wp\/v2\/tags?post=246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}