Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用jQuery或JavaScript降低html标记内的值?_Jquery - Fatal编程技术网

如何使用jQuery或JavaScript降低html标记内的值?

如何使用jQuery或JavaScript降低html标记内的值?,jquery,Jquery,我正在使用jquery:$('#entrycount').val()-1 我的HTML: 参赛作品总数 在这里,我无法使用jquery减少数值。我想减少side h2标记中的值。使用text()而不是仅用于表单控件元素的val() $(“按钮”)。单击(()=>{ $('#entrycount')。文本((#,curr)=>curr-1) }) 减少计数 参赛作品总数 20 val()仅用于表单控件,而不用于内容元素 <div class="widget style1 n

我正在使用jquery:
$('#entrycount').val()-1
我的HTML:


参赛作品总数
在这里,我无法使用jquery减少数值。我想减少side h2标记中的值。

使用
text()
而不是仅用于表单控件元素的
val()

$(“按钮”)。单击(()=>{
$('#entrycount')。文本((#,curr)=>curr-1)
})

减少计数
参赛作品总数
20
val()
仅用于表单控件,而不用于内容元素
<div class="widget style1 navy-bg">
  <div class="row">
    <div class="col-3">
      <i class="fa fa-cloud fa-5x"></i>
    </div>
    <div class="col-8 text-right">
      <span>Total Entries </span>
      <h2 id="entrycount" class="font-bold">
        <%= Count%>
      </h2>
    </div>
  </div>
</div>