Hi, I'm having some requirement where i need to show some value in div tags and latter parse it to save in database. the value which is html escape char are getting translated when in div thus making the input wrong. like some where i'm using & and < they got displayed as" &" html escape code. what i want is that what ever be inputed is show as it is like if < is a input only < is shows not < and vice-versa
presently when user enter < and < both displayed as < but value remain as < when accessed to any variable. what i want is that < and < both displayed and value assigned to variable remain as it is means < and <
i tried using innerHTML, but not able to solve it other things like innerText doesnot work with div so I'm bit stuck any help would be appreciated
Thanks
Rahul
Recommended Answers
Jump to PostRahul,
Here's a quick test which may help shed some light :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Untitled</title> <style type="text/css"> .wrapper { …
Jump to PostBrowser incompatibility: textContent vs. innerText.
Also, I think setting innerText obliterates all elements in innerHTML (not an issue here).
Jump to PostBrowser incompatibility: textContent vs. innerText.
Good point. Can you suggest a cross-browser solution to both read and write an element's innerText/textContent?
I suspect : reading - easy; writing - slightly harder.
Airshow
Jump to Postsimple example
Here are three functions that highlight the issues. The output of 'dataworks' and 'textworks' is different (which you can make clearer by replacing the space I used as a placeholder in each of the first four elements with a printing character). If you play around with 'datafails' you …
All 13 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.