Get SharePoint Online (Office 365 Enterprise E3) Subscription for your Business NOW

SharePoint Online Delete all Items from list using JavaScript Object model

Here we will discuss how to delete all SharePoint list items using JavaScript object model in SharePoint Online Office 365. I have used to code inside a script editor web part inside a web part page.

Below is the JavaScript object model.

Also read:
Steps to retrieve alternative languages from language settings in SharePoint online using JavaScript object model?

How to use Repeating Section in Nintex forms for Office 365 SharePoint online?

Get All Attachments From SharePoint 2013 List Item using Rest API

<input type=”button” id=”btnDeleteItems” value=”Click Here”/>

<script src=””></script>







function DeleteAllItems(){

var ctx = SP.ClientContext.get_current(),

list = ctx.get_web().get_lists().getByTitle(‘Ideas’),

query = new SP.CamlQuery(),

items = list.getItems(query);

ctx.load(items, “Include(Id)”);

ctx.executeQueryAsync(function () {

var enumerator = items.getEnumerator(),

itemArray = [];

while (enumerator.moveNext()) {



for (var s in itemArray) {







Hope this will be helpful.

Check out Best Alternative to InfoPath -> Try Now

EnjoySharePoint YouTube Channel

You May Also like the Following SharePoint Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site

View all posts by Bijay Kumar →