尾随零应该在之前/之后自动出现。 (点)

I have an input box :

<input autocomplete="off"  class='amount'>

If i type .75 in the input field then 0 should be added automatically before .75 so that it should become 0.75

Also if i type 1.3 then it should become 1.30

I have tried :

echo "<script>
    $('.amount').on('change', function(){
        $(this).val(parseFloat($(this).val()).toFixed(2));
    });
</script>";

Edited : its showing me same value what i have typed , no change happening

<!DOCTYPE html>
<html>
    <head>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <?php 
    echo "<script>
        $(document).ready(function(){
            $('.amount').on('change', function(){
                $(this).val(parseFloat($(this).val()).toFixed(2));
            });
        });
    </script>";
    ?>
    </head>
    <body>
        <input autocomplete="off"  class='amount'/>
    </body>
</html>

You need to make sure to wrap your event handlers in document.ready to make sure jquery is properly loaded before assigning them. This is why @laaposto 's fiddle works because jquery is already loaded in the fiddle before the event handler is assigned.