junkerstock
 test-行番号ー折返有 数表示2 最小限 

<textarea id="tx"></textarea>
<p>Line: <span id="dsp">1 / 1</span></p>

<script>
const tx = document.getElementById('tx');
const dsp = document.getElementById('dsp');

const update = () => {
// 現在の行数
const cur = tx.value.substr(0, tx.selectionStart).split('\n').length;
// 全行数
const tot = tx.value.split('\n').length;

dsp.innerText = cur + ' / ' + tot;
};

tx.oninput = tx.onkeyup = tx.onclick = update;
</script>


使用変数

cur
dsp
id
innerText
onclick
oninput
onkeyup
tot
tx
update