Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the Document</title> </head> <body> <p id="pId">Select: <b>bold</b> and <i>italic</i></p> <script> // select from the <p> 0th child to the last child document.getSelection().setBaseAndExtent(pId, 0, pId, pId.childNodes.length); </script> </body> </html>