The guys have done the finishing touches left ... I'm trying to reveal the optiona value by this method

$('#select option:eq(3)').val("new values") 

but nothing happens ...

  • explain exactly what you want to do. And then in the title of the question there are the words selected , but in the question itself there is no such thing. This code should potentially be the 4th option child for the element with the identifier #select to change the value of value . - teran
  • I know but does not change - elik
  • and how it is connected with selected ? In the answer below, everything works. - teran

1 answer 1

It seems everything was written correctly, your code works for me. Can you also change the option text?

 $( document ).ready(function() { $('#select option:eq(3)').val("new values"); $('#select option:eq(3)').html("new values"); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <select id = 'select'> <option value = '1'>1</option> <option value = '2'>2</option> <option value = '3'>3</option> <option value = '4'>4</option> <option value = '5'>5</option> </select>