开发者

I need $(".className").each(function () with div. I can only get it to work with input

The following jQuery code works if my tag is:

<input class="AmountElementValue" readonly="readonly" />

However, it does not work if I make the input a <div />. The code is:

$(".AmountElementValue").each(function () {
    alert($(".AmountElementValue").val());
    var TrimedAmountElementValu开发者_高级运维e = $(this).val().replace(/\$/g, '');
    TrimedAmountElementValue = TrimedAmountElementValue.replace(",", "");
    totalDisbursement += parseFloat(TrimedAmountElementValue);
});

How can use a <div /> instead?


.val() does not work on <div />s; perhaps you want .text() or .html()?


.val() is only defined for input elements. Use .text() instead for a div.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜