i am developing a greasemonkey userscript. I want to edit the post variable, say *x*, before posting it by a webpage. [Here](https://stackoverflow.com/questions/2647861/modify-post-vars-before-post-using-jquery) is the closest answer but the prob is that instead of replacing the *x* value, it appends itself like *x=222&x=previous\_value&name=xyz*. What i would like to get is *x=222&name=xyz*.

```
 $('form').submit(function(e)
                  {
                      var input = $("<input>")
                      .attr("type", "hidden")
                      .attr("name", "x").val("222");
                      $(this).append($(input));
                  })

```