检查画布是否不为空

鱿鱼

我在一个页面上有 3 个签名框,我正在尝试检查它们是否为空/空白。

我试过了,$('#input_5_9').val() == ''但它没有检测到任何东西。当我与画布交互时,HTML.

HTML为画布是:

<canvas id="input_5_9" width="300" height="180" style="border-width: 2px; border-style: dashed; border-color: rgb(221, 221, 221); background-color: rgb(255, 255, 255); cursor: url(&quot;https://website.com/super_signature/pen.cur&quot;), pointer; width: 300px; height: 180px;"></canvas>
阿里雷扎·艾哈迈迪

如果要检查number of nested object in canvas,可以使用$('#input_5_9').children().length检查是否为空。

if($('#input_5_9').children().length == 0)
  console.log("canvas is empty");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<canvas id="input_5_9" width="300" height="180" style="border-width: 2px; border-style: dashed; border-color: rgb(221, 221, 221);
background-color: rgb(255, 255, 255); 
cursor: url(&quot;https://website.com/super_signature/pen.cur&quot;), pointer; width: 300px; height: 180px;">
    </canvas>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章