I have a div (id="right"
) which holds a form with a submit button. Upon clicking Submit, the div should reduce its width. Works fine when I delete the <form>
tags from my HTML, but doesn't work when the form is there. How come?
HTML:
<div id="right">
<form method="POST" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
... some input fields here ...
<input id = "btnRight" type="submit" value="Submit">
</form>
</div>
CSS:
#right {
width: 50%;
min-width: 35px;
float: right;
margin: 0;
position: relative;
overflow: hidden;
}
JQuery:
$(document).ready( function(){
$('#btnRight').click(function () {
$('#right').animate({ width: '3%' }, 'slow');
});
});
Any help is much appreciated!