Jump to content


Getting Selected Text

  • Please log in to reply
2 replies to this topic

#1 abdfahim

  • Members
  • PipPipPip
  • Abd Fahim
  • 535 posts

Posted 17 August 2006 - 03:52 AM

I have the follwing HTML code

This is the body text. From here I will select text
<input type="button" name="test" id="t1" value="push">

I want that when I select any text in the body section of the webpage and press push button, the selected text will be shown in a alert window. How can I do this??

#2 ari_aaron

  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts
  • LocationToronto, Canada

Posted 22 August 2006 - 02:50 PM

I don't think there is any way of telling what text i selected.

#3 jaronblake

  • Members
  • PipPip
  • Member
  • 17 posts

Posted 29 August 2006 - 05:05 PM

you can do this with a textbox and its value
function alertme(){
<form name="formname">
<input type="text" value="This is the body text. From here I will select text" size="60" name="text1">
<input type="button" name="test" id="t1" value="push" onclick="alertme();">

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users