Tuesday, September 2, 2014

onblur event/function to SharePoint form fields using JQuery

1.Add JQuery Library to SharePoint from Page

2.write the following code in document.ready function
3.in this example we getting two values from a,b and calculated displayed in c column

$(document).ready(function(){

   var textarea=$("input[title='c']");
          textarea.blur(function(){            
              calculateAmount();        
         });

});
function   calculateAmount()
{
 var a=document.getElementById('trAddition').getElementsByTagName('td')  [1].getElementsByTagName('input');
 var b=document.getElementById('intercost').getElementsByTagName('td')  [2].getElementsByTagName('input');
 var c=document.getElementById('intercost').getElementsByTagName('td')  [3].getElementsByTagName('input');
c.value=a.value+b.value
}


In the above example we are getting the tr td's that contains
a,b and c column values

No comments:

Post a Comment