
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
HTML5 IndexedDB Example
The following function is an example of IndexedDB to add data:
function add() { var request = db.transaction(["employee"], "readwrite") .objectStore("employee") .add({ id: "001", name: "Amit", age: 28, email: "demo1@example.com" }); request.onsuccess = function(event) { alert("Amit has been added to your database."); }; request.onerror = function(event) { alert("Unable to add data\r
Amit is already exist in your database! "); } }
Above, we added the following details in the database:
const employeeData = [ { id: "001", name: "Amit", age: 28, email: "demo1@example.com" }, ];
- Related Articles
- IndexedDB in HTML5
- What is HTML5 IndexedDB and why it is used?
- Example of MathML in HTML5
- Example of createSignalingChannel() in HTML5
- Example of Event Handlers in HTML5 CORS
- HTML5 tag
- HTML5 Semantics
- Translating HTML5 canvas
- HTML5 Canvas distorted
- CORS in HTML5
- MediaStream in HTML5
- HTML5 Character Encodings
- HTML5 Modernizr Usage
- Override HTML5 validation
- HTML5 Microdata Attributes

Advertisements