{"id":11775,"date":"2022-08-23T14:11:01","date_gmt":"2022-08-23T14:11:01","guid":{"rendered":"https:\/\/www.webhozz.com\/blog\/?p=11775"},"modified":"2023-05-19T08:21:53","modified_gmt":"2023-05-19T08:21:53","slug":"jquery-callback","status":"publish","type":"post","link":"https:\/\/www.webhozz.com\/blog\/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, karena efek jQuery membutuhkan waktu untuk menyelesaikan kode baris berikutnya akan dieksekusi saat efek sebelumnya masih berjalan. Untuk mencegah hal ini terjadi, 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&nbsp;<strong><em>slideToggle()<\/em><\/strong>&nbsp;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&nbsp;<strong><em>alert()<\/em><\/strong>&nbsp;di dalam&nbsp;<em>callback function<\/em>&nbsp;pada metode&nbsp;<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&nbsp;<em>callback function<\/em>&nbsp;untuk metode efek jQuery lainnya, seperti&nbsp;<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 menampilkan pesan peringatan yang sama dua kali per elemen&nbsp;<strong><em>&lt;h1&gt;<\/em><\/strong>&nbsp;dan&nbsp;<strong><em>&lt;p&gt;<\/em><\/strong>, setelah mengklik tombol pemicunya.<\/p>\n\n\n\n<p><\/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":1,"featured_media":11743,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[4383,4384,4385,4386,4381,4382],"class_list":["post-11775","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-belajar-web-design","tag-belajar-jquery-callback","tag-belajar-jquery-callback-pemula","tag-kursus-jquery-callback-bandung","tag-kursus-jquery-callback-jakarta","tag-tutorial-jquery-callback","tag-tutorial-jquery-callback-pemula"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>jQuery : Callback - WebHozz Blog<\/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\/blog\/jquery-callback\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"jQuery : Callback - WebHozz Blog\" \/>\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\/blog\/jquery-callback\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHozz Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-23T14:11:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-19T08:21:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2022\/08\/jQuery_1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"750\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\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\\\/blog\\\/jquery-callback\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/jquery-callback\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#\\\/schema\\\/person\\\/d5f539ad171dc74baaf6a98dfef6fcef\"},\"headline\":\"jQuery : Callback\",\"datePublished\":\"2022-08-23T14:11:01+00:00\",\"dateModified\":\"2023-05-19T08:21:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/jquery-callback\\\/\"},\"wordCount\":177,\"publisher\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/jquery-callback\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/jQuery_1.jpg\",\"keywords\":[\"Belajar jQuery Callback\",\"Belajar jQuery Callback Pemula\",\"Kursus jQuery Callback Bandung\",\"Kursus jQuery Callback Jakarta\",\"Tutorial jQuery Callback\",\"Tutorial jQuery Callback Pemula\"],\"articleSection\":[\"Belajar Web Design\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/jquery-callback\\\/\",\"url\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/jquery-callback\\\/\",\"name\":\"jQuery : Callback - WebHozz Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/jquery-callback\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/jquery-callback\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/jQuery_1.jpg\",\"datePublished\":\"2022-08-23T14:11:01+00:00\",\"dateModified\":\"2023-05-19T08:21:53+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/jquery-callback\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/jquery-callback\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/jquery-callback\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/jQuery_1.jpg\",\"contentUrl\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/jQuery_1.jpg\",\"width\":\"750\",\"height\":\"400\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/jquery-callback\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"jQuery : Callback\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/\",\"name\":\"WebHozz Blog\",\"description\":\"Kursus Web &amp; Android di Jakarta Bandung\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#organization\",\"name\":\"WebHozz\",\"url\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/logo-persegi.jpg\",\"contentUrl\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/logo-persegi.jpg\",\"width\":442,\"height\":442,\"caption\":\"WebHozz\"},\"image\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#\\\/schema\\\/person\\\/d5f539ad171dc74baaf6a98dfef6fcef\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bff35e4083f3870e2f911c4437e788147d340f274268d361dd7e1cf20bebb156?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bff35e4083f3870e2f911c4437e788147d340f274268d361dd7e1cf20bebb156?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bff35e4083f3870e2f911c4437e788147d340f274268d361dd7e1cf20bebb156?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"url\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"jQuery : Callback - WebHozz Blog","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\/blog\/jquery-callback\/","og_locale":"en_US","og_type":"article","og_title":"jQuery : Callback - WebHozz Blog","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\/blog\/jquery-callback\/","og_site_name":"WebHozz Blog","article_published_time":"2022-08-23T14:11:01+00:00","article_modified_time":"2023-05-19T08:21:53+00:00","og_image":[{"width":750,"height":400,"url":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2022\/08\/jQuery_1.jpg","type":"image\/jpeg"}],"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\/blog\/jquery-callback\/#article","isPartOf":{"@id":"https:\/\/www.webhozz.com\/blog\/jquery-callback\/"},"author":{"name":"admin","@id":"https:\/\/www.webhozz.com\/blog\/#\/schema\/person\/d5f539ad171dc74baaf6a98dfef6fcef"},"headline":"jQuery : Callback","datePublished":"2022-08-23T14:11:01+00:00","dateModified":"2023-05-19T08:21:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhozz.com\/blog\/jquery-callback\/"},"wordCount":177,"publisher":{"@id":"https:\/\/www.webhozz.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.webhozz.com\/blog\/jquery-callback\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2022\/08\/jQuery_1.jpg","keywords":["Belajar jQuery Callback","Belajar jQuery Callback Pemula","Kursus jQuery Callback Bandung","Kursus jQuery Callback Jakarta","Tutorial jQuery Callback","Tutorial jQuery Callback Pemula"],"articleSection":["Belajar Web Design"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.webhozz.com\/blog\/jquery-callback\/","url":"https:\/\/www.webhozz.com\/blog\/jquery-callback\/","name":"jQuery : Callback - WebHozz Blog","isPartOf":{"@id":"https:\/\/www.webhozz.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webhozz.com\/blog\/jquery-callback\/#primaryimage"},"image":{"@id":"https:\/\/www.webhozz.com\/blog\/jquery-callback\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2022\/08\/jQuery_1.jpg","datePublished":"2022-08-23T14:11:01+00:00","dateModified":"2023-05-19T08:21:53+00:00","breadcrumb":{"@id":"https:\/\/www.webhozz.com\/blog\/jquery-callback\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhozz.com\/blog\/jquery-callback\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhozz.com\/blog\/jquery-callback\/#primaryimage","url":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2022\/08\/jQuery_1.jpg","contentUrl":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2022\/08\/jQuery_1.jpg","width":"750","height":"400"},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhozz.com\/blog\/jquery-callback\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhozz.com\/blog\/"},{"@type":"ListItem","position":2,"name":"jQuery : Callback"}]},{"@type":"WebSite","@id":"https:\/\/www.webhozz.com\/blog\/#website","url":"https:\/\/www.webhozz.com\/blog\/","name":"WebHozz Blog","description":"Kursus Web &amp; Android di Jakarta Bandung","publisher":{"@id":"https:\/\/www.webhozz.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhozz.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webhozz.com\/blog\/#organization","name":"WebHozz","url":"https:\/\/www.webhozz.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhozz.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2018\/04\/logo-persegi.jpg","contentUrl":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2018\/04\/logo-persegi.jpg","width":442,"height":442,"caption":"WebHozz"},"image":{"@id":"https:\/\/www.webhozz.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.webhozz.com\/blog\/#\/schema\/person\/d5f539ad171dc74baaf6a98dfef6fcef","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/bff35e4083f3870e2f911c4437e788147d340f274268d361dd7e1cf20bebb156?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/bff35e4083f3870e2f911c4437e788147d340f274268d361dd7e1cf20bebb156?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bff35e4083f3870e2f911c4437e788147d340f274268d361dd7e1cf20bebb156?s=96&d=mm&r=g","caption":"admin"},"url":"https:\/\/www.webhozz.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/posts\/11775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/comments?post=11775"}],"version-history":[{"count":2,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/posts\/11775\/revisions"}],"predecessor-version":[{"id":12468,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/posts\/11775\/revisions\/12468"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/media\/11743"}],"wp:attachment":[{"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/media?parent=11775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/categories?post=11775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/tags?post=11775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}