0

I have a select menu that updates a graph .on('change') using d3.

I am trying to get the select menu to have a default text value 'Select from me'.

But when the .on('change') is triggered I don't want this value to update the graph. The way I have it now when you choose to select the default text 'Select from me' it tries to update the graph based on this value.

So is there a way to disable this from acting as an option?

D3 CODE

var select = d3.select('#select').append('select');

select.append('option').text('Select from me');

select.attr( 'id', 'select-menu' )
  .on( 'change', updateGraph )
  .selectAll( 'option' )
  .data( dataNest )
  .enter().append( 'option' )
  .attr( 'value', function (d) {return d.key; } )
  .text( function (d) { return d.key; } );
Alan Dunning
  • 1,311
  • 8
  • 16

0 Answers0