I am in the process of learning Backbone.js. I currently assume that if one is using Backbone.js then all client-side javascript/jQuery should be integrated with Backbone. From
Attache all your plugins when you render the view:
you can do something like this:
render: function () {
var view = this;
// Fetch the template, render it to the View element and call done.
application_namespace.fetchTemplate(this.template, function (tmpl) {
var viewModel = view.model.toJSON();
view.$el.html(tmpl(viewModel));
view.$("#categories").autocomplete({
minLength: 1,
source: function (request, response) {
$.getJSON("url" + view.storeId, {
term: request.term,
}, function (data) {
response($.map(data, function (item) {
return {
value: item.title,
obj: item
};
}));
});
},
select: function (event, ui) {
//your select code here
var x = ui.item.obj;
var categories = view.model.get("x");
// bla bla
}
error: function (event, ui) {
//your error code here
}
}
});
}
Hope that helps