Vertical Text with jQuery

后端 未结 6 1825
猫巷女王i
猫巷女王i 2021-02-15 14:11

I\'m looking to vertically align text by adding
tags between characters with jQuery.

6条回答
  •  终归单人心
    2021-02-15 15:10

    Not tested, but it should work.

    var element = $( '#foo label' );
    var newData = '';
    var data = element.text();
    var length = data.length;
    var i = 0;
    
    while( i < length )
    {
    
        newData += data.charAt( i ) + '
    '; i++; } element.html( newData );

提交回复
热议问题