replaceWith() works only the first time

replaceWith() works only the first time

Hi everyone,

I using jQuery for the first time.
I want to use the the replaceWith() function in a html form with many select buttons to replace the select elements from a second button to other values when the value of a first select button has been changed. The html code is generated in a perl cgi script (I write this only for completeness).
The function works but only the first time when I change the value of the first button (e.g. button "Type").
On the second change no more actions are done on button "Severity".

Can I use this function replaceWith() for this case ?
If yes what I make wrong ?

Code fragment:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <body>
   <script src="/jquery.js" type="text/javascript"></script>

   <table>
      <tr>
        <td>Type:
        <select onChange="var selectCode = getOneofs('val1', 'val2', 'val3'); $('.severity').replaceWith(selectCode);" id="type" name="type">
          <option value="-Please Select-" >-Please Select-
          <option value="defect" >defect
          <option value="enhancement" >enhancement
          <option value="work" >work
        </select>
      </td>
    </tr>
      <tr>
        <td>Severity:
        <div class="container">
          <div class="severity">
            <select name=severity>
              <option value="-Please Select-" >-Please Select-
              <option value="1" >1
              <option value="2" >2
            </select>
          </div>
        </div>
      </td>
    </tr>
   </table>
  </body>
</html>

The javascript function 'getOneofs() returns html code as listed below as example:

<select size=1 name=severity>
  <option value="-Please Select-" >-Please Select-
  <option value="X" >X
  <option value="Y" >Y
        :        :
</select>

I added alert() debug functions in the javascript function getOneofs() and the output looks ok.
So the var "selectCode" should be also ok.

Thanks for a hint.

Werner
Nuernberg/Germany