0

I am looking to enable the Narrative porition of this code to be editable.

<!-- Style -->
<style type="text/css">
.item-title-clickable{
    font-size:1.1em;
    background-color: #c7e0f4;
    padding:2px 5px;
    margin-top:2px;
    cursor:pointer;
}
.item-narrative{
    display: none;
    border-right:3px #c7e0f4 solid;
    border-bottom:3px #c7e0f4 solid;
    border-left:3px #c7e0f4 solid;
    padding:3px;
}
</style>
<!-- HTML placeholder -->
<div id="faq_placeholder"></div>
<!-- Script -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript">
function getFaqItems(){
    jQuery.ajax({
        url: "/WEB_BASE_URL/_api/web/lists/getbytitle('LIST_NAME')/items",
        method: "GET",
        headers: {
            "accept": "application/json; odata=verbose",
            "content-type": "application/jsom;odata=verbose",
            "X-RequestDigest": document.getElementById("__REQUESTDIGEST").value
        }
    }).done(function (data) {
        var b = [];
        jQuery.each(data.d.results,function(i,item){
            b.push("<div class='item-title-clickable' onclick='jQuery(this).next().slideToggle(100);'>"+item.Title+"</div>");
            b.push("<div class='item-narrative'>"+item.Narrative+"</div>");
        });
        jQuery("#faq_placeholder").html(b.join(""));
    }).fail(function (err) {
        jQuery("#faq_placeholder").html(JSON.stringify(err));
    });
}
// Call function
getFaqItems();
</script>
</code>

I am at a loss of how to accomplish this. Any help would be appreciated.

0

You can replace with below portion while creating html:

    b.push("<div class='item-narrative'>"+item.Narrative+"<input type='text' style='height:80px;width:100%;' value='"+item.Narrative+"' /></br></div>");
});

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.