문제

I need to add a line break immediately prior to every instance of a parenthesis using JavaScript (specifically jQuery).

I've been unable to locate any documentation that indicates I can search a string, by specifying it's class/ID, for a special character (in this case the parenthesis) and prepend HTML to it.

Can anyone assist me? Thank you!

도움이 되었습니까?

해결책

$("#unique").html( function(i, oldtext){
    return oldtext.replace("(","<br> (");
});

fiddle

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top