

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to allow long and unbreakable words to be broken and wrap to the next line in JavaScript?
Use the wordWrap property in JavaScript to allow long words to be broken and wrap to the next line.
Example
You can try to run the following to learn how to work with wordWrap property −
<!DOCTYPE html> <html> <head> <style> #box { width: 150px; height: 150px; background-color: lightblue; border: 1px solid black; } </style> </head> <body> <button onclick = "display()">Set</button> <div id = "box"> ThisisDemoText.ThisisDemoText.ThisisDemoText.ThisisDemoText.Thisis DemoText.ThisisDemoText. </div> <script> function display() { document.getElementById("box").style.wordWrap = "break-word"; } </script> </body> </html>
- Related Questions & Answers
- Break the line and wrap onto next line with CSS
- How to wrap long lines in Python?
- How to allow to go next internal pages in android webview?
- Numbers and operands to words in JavaScript
- How can we implement line wrap and word wrap text inside a JTextArea in Java?
- Program to check a string can be broken into given list of words or not in python
- Implement Onclick in JavaScript and allow web browser to go back to previous page?
- How to wrap each input line to fit in specified width in Linux?
- How to create a long multi-line string in Python?
- How to not allow duplicate entries to be entered a MySQL Table?
- JavaScript: How to allow users to change the font-size of a webpage?
- Function to check two strings and return common words in JavaScript
- What are the minimum MySQL user privileges to allow optimize and repair?
- How can Tensorflow and Python be used to build ragged tensor from list of words?
- Can I find out the next auto_increment to be used?
Advertisements