Hello,
I have implemented the kendo UI drop down list in jQuery making use of the no data template too add a new item when the search returns no results. My no data template is defined as follows:
<script id="noDataTemplate" type="text/x-kendo-tmpl">
<div>
<button class="k-button" onclick="addNew('#: instance.filterInput.val() #')">Add</button>
</div>
</script>
and the JS function it calls:
function addNew(newItemName) {
alert(newItemName);
//logic will go here to add the new item to the drop down list
}
This works perfectly, however if the text typed into the search bar contains an apostrophe the button becomes unresponsive. Is there any way to escape the apostrophe so that the function is still called successfully, and the paramter 'newItemName' will still contain the apostrophe, as the name for the new item can validly contain one.
Many thanks