I am a new jquery / js user trying to pass an argument from a function selector. Here are some of the code:
// function to select data var data = [ {val: 10, year: 1990}, {val: 20, year: 1991} ] var year_data = [] function select_year_data(y) { year_data = data.filter(function(d) {return d.year==y}) }
//Selector
<select name="Year" id = "year_menu" style="width: 230px; position: absolute; left: 400px; top: 50px"> <option value=1990>1990</option> <option value=1991>1991</option> </select>
What I would like to do is something like this:
<onchange>select_year_data($('#year_menu.val()')
But I know that this is not entirely correct.
source share