I am working with http://easyautocomplete.com/. It's working fine but when I am trying to disable select on click, It's not working.
When I am trying to disable default action on onClickEvent/onChooseEvent
, It's showing Uncaught TypeError: Cannot read property 'preventDefault' of undefined
.
I can't figure out why event.preventDefault();
not working. I am not expert. Just for learning purpose.
var options = {
data: [ {name: "Avionet", spec: "air", code: "47201", price: "£120"},
{name: "Car", spec: "ground", code: "47201S", price: "£120"},
{name: "Motorbike", spec: "ground", code: "47203", price: "£120"},
{name: "Plain", spec: "air", code: "4721", price: "£120"},
{name: "Train", spec: "ground", code: "47253", price: "£120"}
],
getValue: "name",
list: {
match: {
enabled: true
},
onClickEvent: function(event) {
event.preventDefault();
}
},
template: {
type: "custom",
method: function(value, item) {
return '<div class="cbs-subject-name">'+ value +'</div><div class="cbs-subject-price"><span class="cbs-meta-icon cbs-meta-icon-price"></span> '+item.price+' </div><div class="cbs-subject-spec"><span class="cbs-meta">Specification:</span> '+item.spec+' </div><div class="cbs-subject-code"><span class="cbs-meta">Entry Code:</span> '+item.code+' </div>';
}
}
};
$("#awesomplete").easyAutocomplete(options);
Thanks for your time. :)