-3

我想显示 hiddentfield 值

 <p style="color: Red">
    Please note that you have <span>
       javascript:$("input[id$=hdnCartCount]").val();
   </span> more pending orders.
     <br />
      Click Checkout to proceed!
 </p>

如何显示?

4

2 回答 2

4

假设您希望这是动态的,稍微重新排列您的 HTML(注意我给您的 span 的 ID):

 <p style="color: Red">
    Please note that you have 
    <span id="pendingOrdersCount"></span> 
    more pending orders.
    <br />
    Click Checkout to proceed!
 </p>

然后你可以这样做:

<script type="text/javascript">

$(function () {
    $("#pendingOrdersCount").text($("input[id$=hdnCartCount]").val());
});

</script>

演示

于 2013-10-03T09:09:32.580 回答
0

尝试为跨度

$("#spanId").text($('#hdnField').val());
于 2013-10-03T09:09:30.027 回答