{"id":704,"date":"2014-08-07T07:18:39","date_gmt":"2014-08-07T05:18:39","guid":{"rendered":"http:\/\/blog.robinglauser.ch\/?p=704"},"modified":"2014-08-06T21:01:22","modified_gmt":"2014-08-06T19:01:22","slug":"bootbox-js-alerts-with-callbacks-for-bootstrap","status":"publish","type":"post","link":"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/","title":{"rendered":"Bootbox.js &#8211; Alerts with callbacks for Bootstrap"},"content":{"rendered":"<p>Some time ago I searched for a plugin with which I could add modals with input fields to my websites and interpret the callback.<\/p>\n<p>This was when I found\u00a0<a href=\"http:\/\/bootboxjs.com\/\" target=\"_blank\">http:\/\/bootboxjs.com\/<\/a>\u00a0a library which provides exactly this function. Using it is super simple:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nbootbox.confirm(&quot;Do you want to delete this?&quot;,\r\nfunction(result) {\r\n  alert(result);\r\n});\r\n<\/pre>\n<p>But you can also create custom dialogs:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nbootbox.dialog({\r\n  message: &quot;I am a custom dialog&quot;,\r\n  title: &quot;Custom title&quot;,\r\n  buttons: {\r\n    success: {\r\n      label: &quot;Success!&quot;,\r\n      className: &quot;btn-success&quot;,\r\n      callback: function() {\r\n        alert('success');\r\n      }\r\n    },\r\n    danger: {\r\n      label: &quot;Danger!&quot;,\r\n      className: &quot;btn-danger&quot;,\r\n      callback: function() {\r\n        alert('dangerzone');\r\n      }\r\n    },\r\n    main: {\r\n      label: &quot;Click ME!&quot;,\r\n      className: &quot;btn-primary&quot;,\r\n      callback: function() {\r\n        alert('primary');\r\n      }\r\n    }\r\n  }\r\n});\r\n<\/pre>\n<p>Still not convinced? Try out some more <a href=\"http:\/\/bootboxjs.com\/examples.html\" target=\"_blank\">examples<\/a>\u00a0or visit the main plugin site:\u00a0<a href=\"http:\/\/bootboxjs.com\/\" target=\"_blank\">http:\/\/bootboxjs.com\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">Some time ago I searched for a plugin with which I could add modals with input fields to my websites and interpret the callback. This was when I found\u00a0http:\/\/bootboxjs.com\/\u00a0a library which provides exactly this function. Using it is super simple: bootbox.confirm(&quot;Do you want to delete this?&quot;, function(result) { alert(result); }); But you can also create custom dialogs: bootbox.dialog({ message: &quot;I &#8230; <a class=\"read-more\" href=\"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[45],"tags":[64,61,63,62,65],"class_list":["post-704","post","type-post","status-publish","format-standard","hentry","category-development","tag-alert","tag-bootboxjs","tag-bootstrap","tag-jquery","tag-modals"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Bootbox.js - Alerts with callbacks for Bootstrap - Robin Glauser<\/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.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bootbox.js - Alerts with callbacks for Bootstrap - Robin Glauser\" \/>\n<meta property=\"og:description\" content=\"Some time ago I searched for a plugin with which I could add modals with input fields to my websites and interpret the callback. This was when I found\u00a0http:\/\/bootboxjs.com\/\u00a0a library which provides exactly this function. Using it is super simple: bootbox.confirm(&quot;Do you want to delete this?&quot;, function(result) { alert(result); }); But you can also create custom dialogs: bootbox.dialog({ message: &quot;I ... Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/\" \/>\n<meta property=\"og:site_name\" content=\"Robin Glauser\" \/>\n<meta property=\"article:published_time\" content=\"2014-08-07T05:18:39+00:00\" \/>\n<meta name=\"author\" content=\"Robin Glauser\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@robinglauser\" \/>\n<meta name=\"twitter:site\" content=\"@robinglauser\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Robin Glauser\" \/>\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.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/\"},\"author\":{\"name\":\"Robin Glauser\",\"@id\":\"https:\/\/www.robinglauser.ch\/blog\/#\/schema\/person\/e1a94504a6ff5171fa13670932514b19\"},\"headline\":\"Bootbox.js &#8211; Alerts with callbacks for Bootstrap\",\"datePublished\":\"2014-08-07T05:18:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/\"},\"wordCount\":154,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.robinglauser.ch\/blog\/#\/schema\/person\/e1a94504a6ff5171fa13670932514b19\"},\"keywords\":[\"alert\",\"bootboxjs\",\"bootstrap\",\"jquery\",\"modals\"],\"articleSection\":[\"Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/\",\"url\":\"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/\",\"name\":\"Bootbox.js - Alerts with callbacks for Bootstrap - Robin Glauser\",\"isPartOf\":{\"@id\":\"https:\/\/www.robinglauser.ch\/blog\/#website\"},\"datePublished\":\"2014-08-07T05:18:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.robinglauser.ch\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Bootbox.js &#8211; Alerts with callbacks for Bootstrap\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.robinglauser.ch\/blog\/#website\",\"url\":\"https:\/\/www.robinglauser.ch\/blog\/\",\"name\":\"Robin Glauser\",\"description\":\"My Blog about Development, Design and my random thoughts.\",\"publisher\":{\"@id\":\"https:\/\/www.robinglauser.ch\/blog\/#\/schema\/person\/e1a94504a6ff5171fa13670932514b19\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.robinglauser.ch\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.robinglauser.ch\/blog\/#\/schema\/person\/e1a94504a6ff5171fa13670932514b19\",\"name\":\"Robin Glauser\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.robinglauser.ch\/blog\/wp-content\/uploads\/2015\/10\/DSC_1244_small.jpg\",\"url\":\"https:\/\/www.robinglauser.ch\/blog\/wp-content\/uploads\/2015\/10\/DSC_1244_small.jpg\",\"contentUrl\":\"https:\/\/www.robinglauser.ch\/blog\/wp-content\/uploads\/2015\/10\/DSC_1244_small.jpg\",\"width\":800,\"height\":530,\"caption\":\"Robin Glauser\"},\"logo\":{\"@id\":\"https:\/\/www.robinglauser.ch\/blog\/wp-content\/uploads\/2015\/10\/DSC_1244_small.jpg\"},\"description\":\"I'm a web developer.\",\"sameAs\":[\"https:\/\/www.robinglauser.ch\",\"https:\/\/www.instagram.com\/robinglauser\/\",\"https:\/\/x.com\/robinglauser\"],\"url\":\"https:\/\/www.robinglauser.ch\/blog\/author\/robin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Bootbox.js - Alerts with callbacks for Bootstrap - Robin Glauser","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.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/","og_locale":"en_US","og_type":"article","og_title":"Bootbox.js - Alerts with callbacks for Bootstrap - Robin Glauser","og_description":"Some time ago I searched for a plugin with which I could add modals with input fields to my websites and interpret the callback. This was when I found\u00a0http:\/\/bootboxjs.com\/\u00a0a library which provides exactly this function. Using it is super simple: bootbox.confirm(&quot;Do you want to delete this?&quot;, function(result) { alert(result); }); But you can also create custom dialogs: bootbox.dialog({ message: &quot;I ... Read More","og_url":"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/","og_site_name":"Robin Glauser","article_published_time":"2014-08-07T05:18:39+00:00","author":"Robin Glauser","twitter_card":"summary_large_image","twitter_creator":"@robinglauser","twitter_site":"@robinglauser","twitter_misc":{"Written by":"Robin Glauser","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/#article","isPartOf":{"@id":"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/"},"author":{"name":"Robin Glauser","@id":"https:\/\/www.robinglauser.ch\/blog\/#\/schema\/person\/e1a94504a6ff5171fa13670932514b19"},"headline":"Bootbox.js &#8211; Alerts with callbacks for Bootstrap","datePublished":"2014-08-07T05:18:39+00:00","mainEntityOfPage":{"@id":"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/"},"wordCount":154,"commentCount":0,"publisher":{"@id":"https:\/\/www.robinglauser.ch\/blog\/#\/schema\/person\/e1a94504a6ff5171fa13670932514b19"},"keywords":["alert","bootboxjs","bootstrap","jquery","modals"],"articleSection":["Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/","url":"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/","name":"Bootbox.js - Alerts with callbacks for Bootstrap - Robin Glauser","isPartOf":{"@id":"https:\/\/www.robinglauser.ch\/blog\/#website"},"datePublished":"2014-08-07T05:18:39+00:00","breadcrumb":{"@id":"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.robinglauser.ch\/blog\/2014\/08\/07\/bootbox-js-alerts-with-callbacks-for-bootstrap\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.robinglauser.ch\/blog\/"},{"@type":"ListItem","position":2,"name":"Bootbox.js &#8211; Alerts with callbacks for Bootstrap"}]},{"@type":"WebSite","@id":"https:\/\/www.robinglauser.ch\/blog\/#website","url":"https:\/\/www.robinglauser.ch\/blog\/","name":"Robin Glauser","description":"My Blog about Development, Design and my random thoughts.","publisher":{"@id":"https:\/\/www.robinglauser.ch\/blog\/#\/schema\/person\/e1a94504a6ff5171fa13670932514b19"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.robinglauser.ch\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.robinglauser.ch\/blog\/#\/schema\/person\/e1a94504a6ff5171fa13670932514b19","name":"Robin Glauser","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.robinglauser.ch\/blog\/wp-content\/uploads\/2015\/10\/DSC_1244_small.jpg","url":"https:\/\/www.robinglauser.ch\/blog\/wp-content\/uploads\/2015\/10\/DSC_1244_small.jpg","contentUrl":"https:\/\/www.robinglauser.ch\/blog\/wp-content\/uploads\/2015\/10\/DSC_1244_small.jpg","width":800,"height":530,"caption":"Robin Glauser"},"logo":{"@id":"https:\/\/www.robinglauser.ch\/blog\/wp-content\/uploads\/2015\/10\/DSC_1244_small.jpg"},"description":"I'm a web developer.","sameAs":["https:\/\/www.robinglauser.ch","https:\/\/www.instagram.com\/robinglauser\/","https:\/\/x.com\/robinglauser"],"url":"https:\/\/www.robinglauser.ch\/blog\/author\/robin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/posts\/704","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/comments?post=704"}],"version-history":[{"count":7,"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/posts\/704\/revisions"}],"predecessor-version":[{"id":714,"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/posts\/704\/revisions\/714"}],"wp:attachment":[{"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/media?parent=704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/categories?post=704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robinglauser.ch\/blog\/wp-json\/wp\/v2\/tags?post=704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}