Suppose you have a div
, and you have huge text in it, and you would like each line to be transformed into <p>
. How would it work?
What I really want is, at the beginning of each line of the div
that has >
to be green, but when you try to do this, you get the whole text.
Example:
<p>Aqui está o texto todo, do nada quebro uma linha
>porém agora esta linha tem um caractere no começo
e este caractere fará com que mude a cor somente da linha
</p>
I took a script that a guy did in a previous question and edited it, however it goes in the whole text, not just the line
$(document).ready(function(){
var green = $('#gt').val();
var first = green.charAt(0);
if(first == '>' || '>'){
$('#gt').addClass('green');
}else{
$('#gt').removeClass('green');
}});
Whoever can clarify how this works, I will be grateful. :)