0

The following is working fine in modern browsers and IE 10+. But in IE <10, it's not. In such cases, $staffSelection displays only the first part but not the string concatenated onto it with the option tags. Not sure why...

$staffSelection = '<div class="' . $branch . '-' . $staffType . '">';
$staffSelection .= '<option value=""></option>';
echo $staffSelection;
Giacomo1968
  • 25,759
  • 11
  • 71
  • 103
Ben Davidow
  • 1,175
  • 5
  • 23
  • 51

1 Answers1

3

The HTML you have is invalid. Options are only permissible inside of a select, optgroup or datalist element. The fact that it is showing the way you want in modern browsers should be considered a fluke.

Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option

Jeff Lambert
  • 24,395
  • 4
  • 69
  • 96
  • I actually create the above string and then insert it into – Ben Davidow Sep 21 '14 at 23:22
  • update your question with a better representation of the issue you're having and I'll take a closer look. – Jeff Lambert Sep 21 '14 at 23:23
  • @BenDavidow If that's the case, that's invalid too — you can't put `
    ` elements inside `
    –  Sep 21 '14 at 23:25
  • If you're trying to have `div`s with / inside of options, this could be related: http://stackoverflow.com/questions/11890597/is-it-posible-to-add-div-or-span-inside-an-option-tag – Jeff Lambert Sep 21 '14 at 23:27