使用jQuery監聽input

廢話不多說,直接上代碼。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>監聽input</title>
    <script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
</head>
<body>

金額:<input type="text" id='othre'/>
<hr />
<div id='sxf'>手續費: <span></span></div>

<script type="text/javascript">
    $(function(){
        $("#othre").bind('input propertychange',function(){
            $("#sxf span").text($(this).val()*0.006);
        });
    });
</script>
</body>

</html>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章