0

This code should select an option in a select list:

$('#ref_nationalite-pharmacien option[value='+t[14]+']').attr("selected", "selected");

It works fine with Google Chrome and Opera.

With Firefox (all version, I'm using Firefox 34), the option is not selected.

I tried to replace attr by pop, without result.

This is a short part of my code:

function actualiser_remplir_champ(reponse)

{ var t = reponse.split("#");

Retour is (I changed private informations):

283##SMITH#Bill#1964-09-28#1987-01-01#Google Street 19#Mons##523601#1##sspf  formation specifique et generale##21#

The last number 21 is the value to select in my select list, it doesn't work with Firefox but works fine with other web browser.

Cœur
  • 37,241
  • 25
  • 195
  • 267
user3553866
  • 316
  • 1
  • 3
  • 15

1 Answers1

0

This is a known FireFox problem and the solution is found in this SO-thread (which got it from another SO-thread): https://stackoverflow.com/a/10096033/844932

Add autocomplete="off" HTML attribute to every select tag. (source: https://stackoverflow.com/a/8258154/260080)

This fixes the ODD behavior in FireFox.

Community
  • 1
  • 1
Maffelu
  • 2,018
  • 4
  • 24
  • 35