I try to change the text when the user selects another option from the drop-down list. I am using Backbone.js and trying to figure out how to get the text belonging to the track when the user selects an option.
As a continuation, if I did not set the value of the track.text option, but rather track.title, how could I get it from a .js file? I originally set track.title and track.text in a JSON file. I am trying to learn how to get information from JSON files. Thank!!
window.LibraryLessonView = LessonView.extend({
events: {
"change .sel " : "changeText"
},
changeText: function() {
}
});
This is in my HTML file:
<script type="text/template" id="lesson-template">
<span class="lesson-title"><%= title %></span>
<select class="sel">
<% _.each(tracks, function(track) { %>
<option value = <%= track.title %> ><%= track.title %></option>
<% }); %>
</select>
<p> Blah </P>
</script>
source
share