tags:

views:

45

answers:

1

The following is an output from an old CMS.

I'd like to insert

<br />

after

(<A HREF="edit-8.asp">Rediger dine kundeopplysninger</A>)

to become

(<A HREF="edit-8.asp">Rediger dine kundeopplysninger</A>)<br />

with jquery.

<div id="system">
        <FORM ACTION="confirm-8.asp" METHOD="post" NAME="kassaForm">
        <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="2" WIDTH="100%">
         <TR>
          <TD CLASS="td-menu" COLSPAN="7">
            Kundeopplysninger
          </TD>
         </TR>
         <TR>
          <TD CLASS="td-main" COLSPAN="7">
            <BR>

            here any name (<A HREF="edit-8.asp">Rediger dine kundeopplysninger</A>)
            here any address<BR>
            <BR>
            2nd part of address<BR>
            <BR>
          </TD>

         </TR>
   more after here.....

Could anyone help me please.

Thanks in advance.

+1  A: 

Try this:

Example: http://jsfiddle.net/pYTgc/

var textNode = $('#system a[href$="edit-8.asp"]')[0].nextSibling​;

var newValue = textNode.nodeValue.replace(')', ')<br>'); 

$(textNode).replaceWith($('<span/>',{html:newValue}));

Or if you don't want the span there, you can unwrap it.

Example: http://jsfiddle.net/pYTgc/1/

var textNode = $('#system a[href$="edit-8.asp"]')[0].nextSibling​;

var newValue = textNode.nodeValue.replace(')', ')<br>'); 

var span = $('<span/>',{html:newValue});

$(textNode).replaceWith( span );

span.children(':first').unwrap();
patrick dw