I m newbie in jquery space and hope to learn much through Stackoverflow.
I have a Sharepoint 2010 list data item which has Choice data type allowing a user to checkbox more than one value. I m using SPService to get the list items. Below is the code:
$().SPServices({
webURL: 'http://abc.def.com/Products',
operation: 'GetListItems',
listName: listName,
async: false,
CAMLQuery: query,
CAMLViewFields: fields,
CAMLRowLimit: 11,
completefunc:
function (xData, Status)
{ $(xData.responseXML).find("[nodeName=z:row]").each(function ()
{
$("#ProdList").val("-1");//Pre-filled with selected val.
var myProd= $(this).attr("ows_Prod"); //displays in this format ;#myProd1;#myProd2;#
//Here 1. i want to store myProd as an array.
2. eliminate ;#
3. store final array elements as myProd1, myProd2
4. Display myProd1
myProd2
in the dropdown list.
//
$("#ProdList").append('<option>' + myProd+ '</option>');
});
}
});
});
<body>
<select class="Dropdowns" id="ProdList">
<option value="-1">My ProdLists</option>
</select>
</body>
Any pointers? Thanks.