{"id":5017,"date":"2024-01-11T16:40:00","date_gmt":"2024-01-11T16:40:00","guid":{"rendered":"https:\/\/codehim.com\/?p=5017"},"modified":"2024-01-22T14:44:39","modified_gmt":"2024-01-22T09:44:39","slug":"button-loading-animation-in-bootstrap-4","status":"publish","type":"post","link":"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/","title":{"rendered":"Button Loading Animation in Bootstrap 4"},"content":{"rendered":"<p>The &#8220;Button Loading&#8221; is a minimal code snippet to add a loader inside the <a href=\"https:\/\/codehim.com\/category\/bootstrap\/bootstrap-buttons\/\" target=\"_blank\" rel=\"noopener noreferrer\">Bootstrap 4 button<\/a>. You can reveal loading animation on the JavaScript click event to inform the users about the processing of an operation.<\/p>\n<h2>How to Create Loading Animation in Bootstrap Button<\/h2>\n<p>1. First of all, load the <a href=\"https:\/\/getbootstrap.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Bootstrap<\/a> and <a href=\"https:\/\/fontawesome.com\/download\" target=\"_blank\" rel=\"noopener noreferrer\">Font Awesome CSS<\/a> by adding the following CDN links into the head section of your HTML page.<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;!-- Bootstrap CSS --&gt;\r\n&lt;link rel='stylesheet' href='https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.2.0\/css\/bootstrap.min.css'&gt;\r\n&lt;!-- Font Awesome CSS --&gt;\r\n&lt;link rel='stylesheet' href='https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/font-awesome\/4.1.0\/css\/font-awesome.min.css'&gt;\r\n<\/pre>\n<p>2. After that, create a button element with the following mentioned attributes.<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;button type=\"button\" class=\"btn btn-primary btn-lg \" id=\"load1\" data-loading-text=\"&lt;i class='fa fa-circle-o-notch fa-spin'&gt;&lt;\/i&gt; Processing Order\"&gt;Submit Order&lt;\/button&gt;\r\n<\/pre>\n<p>4. Now, load the jQuery JavaScript library and Bootstrap JS just before the closing of body tag.<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;!-- jQuery --&gt;\r\n&lt;script src=\"https:\/\/code.jquery.com\/jquery-3.4.1.min.js\"&gt;&lt;\/script&gt;\r\n&lt;!-- Bootstrap JS --&gt;\r\n&lt;script src='https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/twitter-bootstrap\/3.2.0\/js\/bootstrap.min.js'&gt;&lt;\/script&gt;\r\n<\/pre>\n<p>5. Finally, initialize the button loading animation on click event using the following JavaScript function.<\/p>\n<pre class=\"prettyprint linenums lang-js\">$('.btn').on('click', function () {\r\n\tvar $this = $(this);\r\n\t$this.button('loading');\r\n\tsetTimeout(function () {\r\n\t\t$this.button('reset');\r\n\t}, 8000);\r\n});\r\n<\/pre>\n<p>You&#8217;ve all done! I hope you have successfully created loading animation inside the Bootstrap 4 button. If you need any further help, let me know by comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The &#8220;Button Loading&#8221; is a minimal code snippet to add a loader inside the Bootstrap 4 button. You can reveal&#8230;<\/p>\n","protected":false},"author":1,"featured_media":5023,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[123,128],"tags":[],"class_list":["post-5017","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bootstrap","category-bootstrap-buttons"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Button Loading Animation in Bootstrap 4 &#8212; CodeHim<\/title>\n<meta name=\"description\" content=\"This code snippet helps you create loading animation inside Bootstrap 4 button. Here you can view demo &amp; download button loader animation.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Button Loading Animation in Bootstrap 4 &#8212; CodeHim\" \/>\n<meta property=\"og:description\" content=\"This code snippet helps you create loading animation inside Bootstrap 4 button. Here you can view demo &amp; download button loader animation.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeHim\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codehimofficial\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-11T16:40:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-22T09:44:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codehim.com\/wp-content\/uploads\/2020\/08\/button-loading-in-bootstrap-4.png\" \/>\n\t<meta property=\"og:image:width\" content=\"598\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Asif Mughal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:site\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Asif Mughal\" \/>\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:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/\"},\"author\":{\"name\":\"Asif Mughal\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\"},\"headline\":\"Button Loading Animation in Bootstrap 4\",\"datePublished\":\"2024-01-11T16:40:00+00:00\",\"dateModified\":\"2024-01-22T09:44:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/\"},\"wordCount\":142,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2020\/08\/button-loading-in-bootstrap-4.png\",\"articleSection\":[\"Bootstrap\",\"Bootstrap Buttons\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/\",\"url\":\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/\",\"name\":\"Button Loading Animation in Bootstrap 4 &#8212; CodeHim\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2020\/08\/button-loading-in-bootstrap-4.png\",\"datePublished\":\"2024-01-11T16:40:00+00:00\",\"dateModified\":\"2024-01-22T09:44:39+00:00\",\"description\":\"This code snippet helps you create loading animation inside Bootstrap 4 button. Here you can view demo & download button loader animation.\",\"breadcrumb\":{\"@id\":\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#primaryimage\",\"url\":\"https:\/\/codehim.com\/wp-content\/uploads\/2020\/08\/button-loading-in-bootstrap-4.png\",\"contentUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2020\/08\/button-loading-in-bootstrap-4.png\",\"width\":598,\"height\":450,\"caption\":\"Button Loading Animation in Bootstrap 4\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codehim.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Bootstrap\",\"item\":\"https:\/\/codehim.com\/category\/bootstrap\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Button Loading Animation in Bootstrap 4\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codehim.com\/#website\",\"url\":\"https:\/\/codehim.com\/\",\"name\":\"CodeHim\",\"description\":\"Web Design Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"alternateName\":\"Web Design Codes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codehim.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/codehim.com\/#organization\",\"name\":\"CodeHim - Web Design Code & Scripts\",\"url\":\"https:\/\/codehim.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"contentUrl\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"width\":280,\"height\":280,\"caption\":\"CodeHim - Web Design Code & Scripts\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/codehimofficial\",\"https:\/\/x.com\/CodeHimOfficial\",\"https:\/\/www.instagram.com\/codehim\/\",\"https:\/\/www.linkedin.com\/company\/codehim\",\"https:\/\/co.pinterest.com\/codehim\/\",\"https:\/\/www.youtube.com\/@codehim\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\",\"name\":\"Asif Mughal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"caption\":\"Asif Mughal\"},\"description\":\"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.\",\"sameAs\":[\"https:\/\/codehim.com\"],\"url\":\"https:\/\/codehim.com\/author\/asif-mughal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Button Loading Animation in Bootstrap 4 &#8212; CodeHim","description":"This code snippet helps you create loading animation inside Bootstrap 4 button. Here you can view demo & download button loader animation.","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:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/","og_locale":"en_US","og_type":"article","og_title":"Button Loading Animation in Bootstrap 4 &#8212; CodeHim","og_description":"This code snippet helps you create loading animation inside Bootstrap 4 button. Here you can view demo & download button loader animation.","og_url":"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/","og_site_name":"CodeHim","article_publisher":"https:\/\/www.facebook.com\/codehimofficial","article_published_time":"2024-01-11T16:40:00+00:00","article_modified_time":"2024-01-22T09:44:39+00:00","og_image":[{"width":598,"height":450,"url":"https:\/\/codehim.com\/wp-content\/uploads\/2020\/08\/button-loading-in-bootstrap-4.png","type":"image\/png"}],"author":"Asif Mughal","twitter_card":"summary_large_image","twitter_creator":"@CodeHimOfficial","twitter_site":"@CodeHimOfficial","twitter_misc":{"Written by":"Asif Mughal","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#article","isPartOf":{"@id":"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/"},"author":{"name":"Asif Mughal","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed"},"headline":"Button Loading Animation in Bootstrap 4","datePublished":"2024-01-11T16:40:00+00:00","dateModified":"2024-01-22T09:44:39+00:00","mainEntityOfPage":{"@id":"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/"},"wordCount":142,"commentCount":0,"publisher":{"@id":"https:\/\/codehim.com\/#organization"},"image":{"@id":"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2020\/08\/button-loading-in-bootstrap-4.png","articleSection":["Bootstrap","Bootstrap Buttons"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/","url":"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/","name":"Button Loading Animation in Bootstrap 4 &#8212; CodeHim","isPartOf":{"@id":"https:\/\/codehim.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#primaryimage"},"image":{"@id":"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2020\/08\/button-loading-in-bootstrap-4.png","datePublished":"2024-01-11T16:40:00+00:00","dateModified":"2024-01-22T09:44:39+00:00","description":"This code snippet helps you create loading animation inside Bootstrap 4 button. Here you can view demo & download button loader animation.","breadcrumb":{"@id":"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#primaryimage","url":"https:\/\/codehim.com\/wp-content\/uploads\/2020\/08\/button-loading-in-bootstrap-4.png","contentUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2020\/08\/button-loading-in-bootstrap-4.png","width":598,"height":450,"caption":"Button Loading Animation in Bootstrap 4"},{"@type":"BreadcrumbList","@id":"https:\/\/codehim.com\/bootstrap\/button-loading-animation-in-bootstrap-4\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codehim.com\/"},{"@type":"ListItem","position":2,"name":"Bootstrap","item":"https:\/\/codehim.com\/category\/bootstrap\/"},{"@type":"ListItem","position":3,"name":"Button Loading Animation in Bootstrap 4"}]},{"@type":"WebSite","@id":"https:\/\/codehim.com\/#website","url":"https:\/\/codehim.com\/","name":"CodeHim","description":"Web Design Code Snippets","publisher":{"@id":"https:\/\/codehim.com\/#organization"},"alternateName":"Web Design Codes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codehim.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codehim.com\/#organization","name":"CodeHim - Web Design Code & Scripts","url":"https:\/\/codehim.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/","url":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","contentUrl":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","width":280,"height":280,"caption":"CodeHim - Web Design Code & Scripts"},"image":{"@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codehimofficial","https:\/\/x.com\/CodeHimOfficial","https:\/\/www.instagram.com\/codehim\/","https:\/\/www.linkedin.com\/company\/codehim","https:\/\/co.pinterest.com\/codehim\/","https:\/\/www.youtube.com\/@codehim"]},{"@type":"Person","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed","name":"Asif Mughal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","caption":"Asif Mughal"},"description":"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.","sameAs":["https:\/\/codehim.com"],"url":"https:\/\/codehim.com\/author\/asif-mughal\/"}]}},"views":13390,"_links":{"self":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/5017","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/comments?post=5017"}],"version-history":[{"count":0,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/5017\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media\/5023"}],"wp:attachment":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media?parent=5017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/categories?post=5017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/tags?post=5017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}