Select Event - run javascript

I have a select input and I added an event handler (change -> run script)
this is my script
dateRange1.setRange([moment(),moment()]);
and nothing happens to my dateRange. What am I doing wrong?

Hey @stephen1215,

I think the format is wrong or not properly configured for the date range component.

Screenshot 2021-10-06 at 21.42.48

Try this:

dateRange1.setRange([moment().format('MM/DD/YYYY'), moment().format('MM/DD/YYYY')])

Thank you, That worked. Can you tell me how I would be able to find the name of the js file. I read the document and it said to look for {query_name}.js but this is a widget

Hey there,

@minijohn great catch! :grinning_face_with_smiling_eyes:

@stephen1215 I'm assuming that you are referring to the directions on debugging javascript in our docs. Are you trying to find the name of the script that you are running in the 'Edit change handler' above?

If so, then I believe these docs are referring to JS queries and that this script you are running on 'Change' will not have a name. If you want to be able to find this script by name in the sources of the page you could create a new JS query, move your code into that query, change the action for this event handler to 'Trigger query', and select your new JS query from the query options. You then should be able to search for your query as described here.

I hope that helps :slightly_smiling_face: