0

私はたくさん持ってい<div class="productlistname"><a href="#">The Text!</a></div>ます。私がやりたいことは、すべて.productlistnameを通過してテキストを切り捨て、現在のテキストを切り捨てられたバージョンに置き換えます。

これが私がこれまでに持っているものです:

$(".productlistname a").html($(".productlistname a").html().substring(0,10));

これは最初のものを切り捨て、残りの .productlistname を最初のものの切り捨てられたバージョンに置き換えます。

4

3 に答える 3

1
$(".productlistname a").each(function() {
  $(this).html($(this).html().substring(0,10));
});
于 2010-03-17T07:00:15.360 に答える
1
$(".productlistname a").each(function () {
    $(this).html($(this).html().substring(0,10));
});
于 2010-03-17T07:00:59.870 に答える
0
$(".productlistname a").each(functon(){
  // loopy loop
});
于 2010-03-17T07:01:09.230 に答える