我有一个计算器,它打开时专注于文本框。这个计算器有外包装和带有计算器按钮的子 div 容器。
我的问题是我只想在点击鼠标离开计算器包装器时关闭计算器。$('html').bind('click', function ()....
但是,我每次单击计算器按钮时都会使用此代码,并且上述代码范围仅在计算器包装器上而不是在包含计算器按钮的子 div 容器上。
计算器包装### -<div class="calc-wrapper">
计算器按钮### -<div class="calc-button-wrapper-operator">
<div class="calc-wrapper">
<div class="calc-button-wrapper-operator">
<div class="calc-button">9</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">8</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">7</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">6</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">5</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">4</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">3</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">2</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">1</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">0</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">.</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">-</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">+</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">*</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">/</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">C</div>
</div>
<div class="calc-button-wrapper-operator">
<div class="calc-button">=</div>
</div>