Jump to content

slashme

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

slashme's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Had the same issue: I added a select box with options thru DOM. Like this (JavaScript): select = document.createElement("SELECT"); select.name = "this-is-the-select-name"; select.id = "theID"; select.options[0] = new Option("Option 0", 0); select.options[1] = new Option("Option 1", 1); select.options[2] = new Option("Option 2", 2); select.options[3] = new Option("Option 3", 3); document.getElementById('someparent').appendChild(select); I added a button to the form like this: <input type='button' onclick='alert(document.getElementById("theID").value)' value='Click me'/> I select option 2, click the button, browser returns '2'. Working fine! < In both Safari and FF!!! Next, I submit the form, with option 2 still selected. In PHP, I print_r($_POST). Return value in FF: Array ( [this-is-the-select-name] => 2 ) Return value in Safari: Array ( [this-is-the-select-name] => 0 ) What the ****? SOLUTION Changing the JS code to this fixed it, although I'm not happy with it: document.getElementById('someparent').innerHTML = "<select name='this-is-the-select-name'><option value='0'>Option 0</option><option value='1'>Option 1</option> (etc.) </select>"; Can anyone tell me what's up with Safari?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.