I am kind of new to JavaScript.

However with other references I was able to call a list via Rest API and convert it into an accordion.

Now, I need to be able to search and highlight the terms being searched.

Any help is greatly appreciated.

this is what i have so far:

<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
 <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>

<script type="text/javascript">  
function GetItems(){
var siteURL = _spPageContextInfo.webServerRelativeUrl;
            url: siteURL + "/_api/web/lists/GetByTitle('glossary of terms')/items",   //change the list name
            type: "GET",
            dataType: "json",
            headers: {
            Accept: "application/json;odata=verbose"
        success: function(data) {
         if (data.d.results.length > 0) 
            $( "#accordion" ).accordion({
                collapsible: true,
                active: false,
            $('#accordion').append("<span>No Records Found.</span>");  
        error: function(error){
function GenerateAccordionFromJson(objArray) 
    var accordionContent = "";
    for (var i = 0; i < objArray.length; i++) 
        accordionContent += '<h3>' + objArray[i].Title + '</h3>';               
               //change the column name
        accordionContent += '<div><p>' + objArray[i].Definition + '</p></div>';           //change the column name
    return accordionContent;

<div id="accordion">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.