Friday, 19 February 2016

Get SharePoint list column value using javascript

Below is the function to easily get sharepoint list column value using internal name, its better to get value then using column id.

function getField(fieldType,fieldTitle) {
    var docTags = document.getElementsByTagName(fieldType);
    for (var i=0; i < docTags.length; i++) {
        if (docTags[i].title == fieldTitle) {
            return docTags[i]

to get single line text use :

getField('input' , 'Title');

Choice Colum:

 getField('select' , 'col name');

No comments:

Post a Comment