Vertical Text with jQuery

后端 未结 6 1838
猫巷女王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 14:57

    This builds on Sebastian H's answer, but I tested it and this works

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

提交回复
热议问题