Skip to content Skip to sidebar Skip to footer

Changing Form Method With Js On Firefox

I need to change the method attribute of my form with javascript (jQuery or pure). My form has method='post', i try to change it with: $('#submit-button').click(function(){ va

Solution 1:

this is my code, and it works just fine on both IE/FF/Chrome

<scripttype="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script><scripttype="text/javascript">functionchangeMethod() {
    $("#myPost").attr("method", "get");
}
</script><formmethod="post"id="myPost"><inputtype="text"name="abc"id="abc"value="Something" /><inputtype="submit"value="submit"onclick="changeMethod()" /></form>

Solution 2:

Try this:

$(function(){
    $("#form").attr("method", "get");
});

Solution 3:

You need put code after you declaration of form.

<formid="form"> ... </form><script>
   $("#form").attr("method", "get");
</script>

Solution 4:

maybe you can write the code like this

$("#myPost").prop("method","get")

Post a Comment for "Changing Form Method With Js On Firefox"