Try this
$('#form1').attr("action","/controller/action/id/");
$('#form1').attr("target","upload_iframe");
$('#form1').attr("enctype","multipart/form-data");
I just tried this and it works in every browser for me ..
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#btn").click(function() {
$('#form1').attr("action","/controller/action/id/");
$('#form1').attr("target","upload_iframe");
$('#form1').attr("enctype","multipart/form-data");
});
});
</script>
</head>
<body>
<form id="form1" action="something.html" method="post" name="forma" target="target" enctype="nope">
<a href="#" id="btn">Uno mas</a>
</form>
</body>
</html>
It works this way for me as well, just tested IE7 & 8 :
action = '/controller/action/id/';
target = 'upload_iframe';
enctype = 'multipart/form-data';
$('#form1').attr("action",action);
$('#form1').attr("target",target);
$('#form1').attr("enctype",enctype);
console.log($('#form1').attr("action") + " " + $('#form1').attr("target") + " " + $('#form1').attr("enctype"));
alert($('#form1').attr("action") + " " + $('#form1').attr("target") + " " + $('#form1').attr("enctype"));