Wednesday, September 19, 2012

jQuery split

Here is now to get at the real public facing value in a SharePoint drop down list with jQuery, stripping away the noise.

var currentAdministration = $(adminselect+':selected').text();
var firstCurrentAdministrationCollection = currentAdministration.split("#");
currentAdministration = firstCurrentAdministrationCollection[1];
var secondCurrentAdministrationCollection = currentAdministration.split("1");
currentAdministration = secondCurrentAdministrationCollection[0];

 
 

I got this from here which has more details.

The 1 to split on is the 1 in the number 12 which I suspect may vary as a number based on the position of the field within the form or perhaps something else.

No comments:

Post a Comment