Skip to main content

Posts

Showing posts from April, 2019

How to post Data in SharePoint list using ajax with jQuery ?

Post Data in a SharePoint list Using jQuery: Requirements: i) SharePoint List Name ii) Id for the data ii) List EntityType Name** Just fullFill the above requirement and you will able to post data in List. function saveData(id,listName){       var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/getbytitle('"+listName+"')/Items('" + id + "')";       $.ajax({         url: requestUri, // list item ID         type: "POST",         data: JSON.stringify({           __metadata: {                 type: "SP.Data.College_x0020_DataListItem"//// it defines the ListEntityTypeFullName           },           'Name'                   : 'Rajparam',           'Age' : 25,     ...

How to get year from date in javascript ?

Get year from date in javascript: Bullet Code (small and accurate): var date= new Date("04/15/2009").getFullYear(); console.log(date) // 2009 OR var date= new Date("Wed Dec 30 2009 00:00:00 GMT+0800").getUTCFullYear(); console.log(date);

How to get list item entity type full name of a SharePoint list using REST API ?

REST API to get list item entity type full name: Bullet method (small and accurate): siteurl( AbsoluteUrl ) + /_api/Web/Lists/getbytitle('ListName')/ListItemEntityTypeFullName or   _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/getbytitle('SPList')/items?select=EntityTypeFullName **Use this above API just replacing absolute site URL and list name **Then put this prepared URL into browser and press enter button and obtain list entity type full name of related list. **You will get ListEntityTypeFullName like " SP.Data.EmployeeListItem " **Employee(may be a list name) How it is? Is it working or not you can tell us using comment section ?

How to get month from given date in javascript ?

Get month from a date in JavaScript: Bullet code(Small and accurate) var date= new Date("04/15/2009");     //date in mm/dd/yyyy var locale = "en-us";  var  month = date.toLocaleString(locale, { month: "long" }); console.log(month); //April /* or if you want the shorter month name: console.log(date.toLocaleString(locale, { month: "short" })); Apr */ Output: April

How to make a countdown timer using JavaScript ?

Make Countdown timer in JavaScript: <!--Html code--> <span id="timer"></span> JavaScript Code // Set the deadline var countDownDate = new Date("Feb 5, 2020 13:30:50").getTime(); // Update the count down every 1 second var x = setInterval(function() {   // Get todays date and time   var now = new Date().getTime();   // Find the distance between now and the count down date   var distance = countDownDate - now;   // Time calculations for days, hours, minutes and seconds   var days = Math.floor(distance / (1000 * 60 * 60 * 24));   var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));   var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));   var seconds = Math.floor((distance % (1000 * 60)) / 1000);   // Display the result in the element with id="demo"   document.getElementById(" timer ").innerHTML = days + " : " + hours + " : "   + minut...

How to get month name from a Date in JavaScript ?

Get Month name from a Date in JavaScript: var date = "2019/04/15";    //date in yyyy/mm/dd or var date ="2019-04-15"; or var date = "2019,04,15"; var indx = new Date(date).getMonth(); //It will give month name in code or as a Index; //getMonth is function which returns month as an integer from 0-11 Now create an Array of Month  const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; var monthName=months[indx]; console.log(monthName); Output: April OR var arrDate = "2010-09-01 00:00:00.0".split("-"); var months = ["January", "February", "March", "April", "May", "June",     "July", "August", "September", "Octob...

How to resolve hibernating problem of windows 10 in laptop/PC ?

Solution of hibernating problem of windows 10 :

How to delete an particular element from array using jQuery ?

Delete a selected element from an array using jQuery: Tested var data = [7,2, 6, 1, 8, 5, 10]; console.log(array) var valIndex= data.indexOf(8); if (valIndex> -1) {   array.splice(valIndex, 1); } console.log(data); Output: [7,2, 6, 1, 5, 10]

How to know that a checkbox is checked/unchecked using jQuery ?

Checked/Unchecked a checkbox: html: <input type="checkbox" id="overAges">OverAges Tested Using jQuery: $("#overAges").click(function(){   if($(this).prop("checked")==true){     console.log('Checked');   } else{     console.log("Unchcked");   } });

How to disable and enable a button of html using JavaScript/jQuery ?

Disable and enable an html button using JavaScript/jQuery: Suppose in html: <button id="btnSave">Save</button> Tested Using JavaScript: To Disable an html button- document.getElementById("btnSave").disabled=true To Enable  an html button - document.getElementById("btnSave").disabled=fals e Using jQuery: To Disable  an html button - $("#btnSave").attr("disabled","disabled"); or $("#btnSave").prop("disabled",true); To Enable  an html button - $("#btnSave").removeAttr("disabled","disabled"); or $("#btnSave").prop("disabled",false);