1 window.onload = function(){                 
2   document.getElementById('area').addEventListener('keydown',function(e){
3     if(e.keyCode!=13) 
    return;
4 e.preventDefault(); 5 this.value += '、'; 6 }); 7 }; 8 9 <textarea name="" id="area"></textarea>

开发过程中,从后台需要导出数据到excel,由于textarea可以进行换行,到了excel中会因为换行的特性自动变为下一行,于是想了一个黑科技,换行变为顿号。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-09-21
  • 2022-03-08
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
猜你喜欢
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2022-12-23
相关资源
相似解决方案