未捕获的引用错误onclick()

时间:2017-01-03 07:33:20

标签: javascript

<button id="btnBleed" class="tab-button" onclick="ClearStatus()" tabindex="-1">BLEED</button>

单击按钮时:

  

未捕获的ReferenceError:未定义ClearStatus

但是该功能在脚本中有明确定义。

以下是代码:

<div class="page-wrapper">
    <div class="button-holder">
        @if (Model.HasAccessToFill == "true")
        {
            <button id="btnstandardFill" class="tab-button selected" onclick="ClearStatus()">STANDARD FILL</button>
            <button id="btnFill" class="tab-button" >FILL</button>
        }

        @if (Model.HasAccessToBleed == "true" && Model.CurrentBalance != 0.0)
        {
            <button id="btnBleed" class="tab-button" onclick="ClearStatus()">BLEED</button>
        }
        @if (Model.HasAccessToAdjust == "true")
        {
            <button id="btnAdjustmentP" class="tab-button" onclick="ClearStatus()">ADJUSTMENT +</button>
            if (Model.CurrentBalance != 0.0)
            {
            <button id="btnAdjustment" class="tab-button" onclick="ClearStatus()">ADJUSTMENT -</button>
            }
        }
        @if (Model.HasAccessToDrop == "true")
        {
            <button id="btnSDrop" class="tab-button" onclick="ClearStatus()">DROP</button>
            <button id="btnFINALDrop" class="tab-button" onclick="ClearStatus()">FINAL DROP</button>
        }
    </div>
<div>
<script type="text/javascript">

    function ClearStatus()
    {
        $('.status-holder span').html("");
    }
</script>

0 个答案:

没有答案