There's no need to hide it even, since it's disconnected from the DOM. - Richard
On Mon, Nov 17, 2008 at 3:01 PM, Hector Virgen <[EMAIL PROTECTED]> wrote: > You can try assigning the value of the textarea to a hidden div. Then > you'll have access to jQuery's functions on the HTML: > var html = $('#content').val(); > var div = $('<div />').css({display: 'none'}); > div.html(html); > div.find('a[target]').removeAttr('target'); > > Then replace the textarea with the html contents of the div: > > var filtered = div.html(); > $(#content).val(filtered); > > -Hector > > > > On Mon, Nov 17, 2008 at 11:22 AM, cc96ai <[EMAIL PROTECTED]>wrote: > >> >> If we do the replace , it will replace all the tag's border & target. >> >> is there anyway it can replace on tag level ? >> >> On Nov 17, 10:34 am, Eric Martin <[EMAIL PROTECTED]> wrote: >> > If you just want the "string" value, how about: >> > >> > var content = $("#content").val(); >> > content = content.replace(/ target=(\'|\")_(new|blank)(\'|\")/, ""); >> > content = content.replace(/ border=(\'|\")\d+(\'|\")/, ""); >> > >> > -Eric >> > >> > On Nov 17, 10:18 am, cc96ai <[EMAIL PROTECTED]> wrote: >> > >> > > I have a text area in the following >> > > <textarea cols="50" rows="5" id="content"> >> > > <a id="link" href="http://www.google.ca" target="_new">test link</a> >> > > <img src="images/test.jpg" border="1" vspace="2" alt="test"> >> > > </textarea> >> > >> > > and I would like to strip out the hyperlink target, and image border, >> > > and get the string of the HTML, >> > > any idea on it? >> > >> > > I try the following, but it only remove the hyperlink in the page, not >> > > the hyperlink in textarea. >> > > $("a").removeAttr("target"); >> > >> > > Can I load the textarea 's content in jquery, then do the select/ >> > > remove the attribute and return as string? >> > >> > > Thanks >> > >