{"id":17035881,"url":"https://github.com/dabeng/simple-popup","last_synced_at":"2026-05-09T00:41:23.020Z","repository":{"id":76025356,"uuid":"50088197","full_name":"dabeng/Simple-Popup","owner":"dabeng","description":"Hope this small jquery snippet to help you replace all primitive popup boxes of native javascript including alert box, confirm box, prompt box.","archived":false,"fork":false,"pushed_at":"2016-02-02T05:59:18.000Z","size":1192,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T02:22:45.032Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://dabeng.github.io/Simple-Popup/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dabeng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-21T06:49:58.000Z","updated_at":"2023-01-19T18:41:25.000Z","dependencies_parsed_at":"2023-04-24T18:12:52.392Z","dependency_job_id":null,"html_url":"https://github.com/dabeng/Simple-Popup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabeng%2FSimple-Popup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabeng%2FSimple-Popup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabeng%2FSimple-Popup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabeng%2FSimple-Popup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dabeng","download_url":"https://codeload.github.com/dabeng/Simple-Popup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245031345,"owners_count":20549913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T08:48:27.755Z","updated_at":"2026-05-09T00:41:17.998Z","avatar_url":"https://github.com/dabeng.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Popup\nHope this small jquery snippet to help you replace all primitive popup boxes of native javascript including alert box, confirm box, prompt box.\n\n## Demo\n- **[jQuery version](http://dabeng.github.io/Simple-Popup/jq-version.html)**\n- **[navtive JS version](http://dabeng.github.io/Simple-Popup/js-version.html)**\n\n![screen record](http://dabeng.github.io/Simple-Popup/screen-record.gif)\n\n## Usage\n- **jQuery version**\n  1. Firstly, introduce jQuery(1.5+) into your page.\n  2. Then, introduce assets(js + css) of Simple Popup into your page.\n  3. Finally, replace any alert(), confirm() and prompt() method in page with simplePopup() method on page.\n\n- **native javascript version**\n  1. First, introduce assets(js + css, obviously, both of the two version use the same css file) of Simple Popup into your page.\n  2. Then, replace any alert(), confirm() and prompt() method in page with simplePopup() \n\n\n### built-in alert box\n```javascript\nalert('An exception occurred.');\nevent.target.nextElementSibling.textContent = 'The application has just got an exception.';\n```\n### Simple Popup alternative of jquery version\n```javascript\nvar alertBox = simplePopup(0, 'An exception occurred.');\n$.when(alertBox).then(function() {\n  $(event.target).next().text('The application has just got an exception.');\n});\n```\n### Simple Popup alternative of javascript version\n```javascript\nsimplePopup(0, 'An exception occurred.').then(function() {\n  event.target.nextElementSibling.textContent = 'The application has just got an exception.';\n});\n```\n\n### built-in prompt box\n```javascript\nvar res = confirm('It\\'s time to change. Do you agree with me?');\nif (res) {\n  event.target.nextElementSibling.textContent = 'Yes, let\\'s go for it.';\n} else {\n  event.target.nextElementSibling.textContent = 'No, this is not the time.';\n}\n```\n### Simple Popup alternative of jquery version\n```javascript\nvar confirmBox = simplePopup(1, 'It\\'s time to change. Do you agree with me?');\n$.when(confirmBox).then(function(res) {\n  if (res) {\n    $(event.target).next().text('Yes, let\\'s go for it.');\n  } else {\n    $(event.target).next().text('No, this is not the time.');\n  }\n});\n```\n### Simple Popup alternative of javascript version\n```javascript\nsimplePopup(1, 'It\\'s time to change. Do you agree with me?').then(function(res) {\n  if (res) {\n    event.target.nextElementSibling.textContent = 'Yes, let\\'s go for it.';\n  } else {\n    event.target.nextElementSibling.textContent = 'No, this is not the time.';\n  }\n});\n```\n\n### built-in prompt box\n```javascript\nvar username = prompt('Please enter your username', 'Michael Jordan');\nif (username != null \u0026\u0026 username != '') {\n  event.target.nextElementSibling.textContent = username + ', hey, welcome back.';\n}\n```\n### Simple Popup alternative of jquery version\n```javascript\nvar promptBox = simplePopup(2, 'Please enter your username', 'Michael Jordan');\n$.when(promptBox).then(function(res) {\n  if (res) {\n    $(event.target).next().text(res + ', hey, welcome back.');\n  } else {\n    $(event.target).next().text('Anoymous user logs in.');\n  }\n});\n```\n### Simple Popup alternative of javascript version\n```javascript\nsimplePopup(2, 'Please enter your username', 'Michael Jordan').then(function(res) {\n  if (res) {\n    event.target.nextElementSibling.textContent = res + ', hey, welcome back.';\n  } else {\n    event.target.nextElementSibling.textContent = 'Anoymous user logs in.';\n  }\n});\n```\n## killer Feature\n1. When you toggle the popup boxes with simpelPopup() method, the overlayed background keeps its position just where it was.\n2. As you can see above, this plugin help you rewrite the current code With the least code modifications.\n\n## Browser Support\n**1. Simple Popup of jquery version**\n  - Chrome 8.0+\n  - Firefox 3.6+\n  - Safari 3.1.2+\n  - Opera 9.64+\n\n**2. Simple Popup of javascript version**\n  - Chrome 32.0+\n  - Firefox 29.0+\n  - Safari 7.1+\n  - Opera 19+\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabeng%2Fsimple-popup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdabeng%2Fsimple-popup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabeng%2Fsimple-popup/lists"}