3
Suppose you have one div
, and that it has an enormous text, and you would like each line to be transformed into <p>
. How would it work?
What I really want is, at the beginning of every line of div
that has >
keep the green color, however, when trying to do this, it takes 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 a guy asked in a question my previous and edited, but it goes in the whole text, and 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');
}});
Who can clarify how this works, I will be grateful. :)
http://stackoverflow.com/questions/15044744/convert-div-to-p
– OnoSendai
@Ibotynelly Thanks for answering, but it’s not how I want.
– pxntxs.