![]() | ![]() |
|
Welcome to the HEXUS.community discussion forums forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and other features. By joining our free community you will have access to post topics, respond to polls and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! |
| |||||||
| Software and web development Databases, graphics, programming, scripting and web development. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Registered User Join Date: Jul 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
| remove HTML tags in javascript using regexp and replace Hi, i have a script i'm working on, a rich text box in DHTML which compiles the content in a hidden text field. I want to take it further to allow the number of characters to be counted, and i think the best way to do this is to take the length property of the compiled code from the hiddent text field on keypress. However this would include all the HTML tags e.g. <font face="verdana"> - so to remove these i need to convert the content of the field to a var, use a regexp to find all the <CONTENT> tags (anything within < and > ) and replace them with nothing - effectivly removing all the HTML content from the variable, and then rechecking its length. Can someone please tell me the regexp and replace command needed in javascript to remove ALL the HTML tags from a paragraph or so of HTML code Thank SP!KE |
| | |
| | #2 (permalink) |
| Goat Boy Join Date: Jul 2003 Location: Alexandra Park, London
Posts: 2,425
Thanks: 0
Thanked 0 Times in 0 Posts
| What language are you writing this in on the back end? You might be better off using an HTML parser. They exist for Java and Perl, and I'm sure there are libraries around for other languages,,, |
| | |
![]() |
| Breadcrumb | ||||||
| ||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |