You can do this :
$('#A').val(function(_,h){ return h.replace(/(\S+)\s*/g,'[B]$1[/B]\n') })
It will also work if you have more elements in your jQuery object (for example with $('textarea')
).
You can do this :
$('#A').val(function(_,h){ return h.replace(/(\S+)\s*/g,'[B]$1[/B]\n') })
It will also work if you have more elements in your jQuery object (for example with $('textarea')
).