I have a simple function which changes a variable passed to it. But after exiting the function, the variable return to it old value. I don't know why or how to fix it
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
var a='test';
$().doit(a);
alert(a);
});
(function ($) {
$.fn.doit = function (input) {
alert(input);
input='new';
alert(input);
};
}(jQuery));
</script>
</head>
<body>
</body>
</html>