私は持っています:
$('#product_category > option:selected').each(function()
それをいくつかのボックスに追加します
.append(<div>'+$(this).text()+'</div>);
しかし、私は9文字だけを表示するようにテキストを部分的にしたい. 長さが 9 より大きい場合は、最初の 9 と +"..." を書きます。
私は試しました:
$('#product_category > option:selected').each(function() {
var text = $(this).text();
if(text.val().length > 8)
{
text = text.substr(0,9)+"...";
}
$('#confirm-category').append('<div class="alert alert-success">'+text+'</div>');
});
しかし、それは機能していません:/
私はどんな助けにも満足します:)