I use selected () to implement my dropdown.
On my homepage I set the dropdown as the following code
//Code in home template
.bookmark_questions
%select
%option{value: "xxxx"} xxxxxx
%option{value: "xxxx"} xxxxxx
%option{value: "xxxx"} xxxxxx
%option{value: "xxxx"} xxxxxx
//Code in home view
render: ->
$(@el).html @template()
@$('select').chosen()
@
In my home view, I am trying to activate the selected " @$('select').chosen()", however, when I try to run the code, I get the following error
this.search_field [0] - undefined

What is the correct way to activate the one selected for my case?
source
share