Jump to content

Recommended Posts

This is a javascript issue, not html, although there are errors in your html:

 

<form action="path/to/file.php" method="post">
<textarea id="target" name="area" cols="20" rows="10"></textarea>
</form>

 

Here is the javascript you can use:

 

<script type="text/javascript">
var targetText = document.getElementById("target").firstChild.data
</script>

 

The text in the textarea will then be contained in the javascript variable 'targetText'

This is a javascript issue, not html, although there are errors in your html:

 

<form action="path/to/file.php" method="post">
<textarea id="target" name="area" cols="20" rows="10"></textarea>
</form>

 

Here is the javascript you can use:

 

<script type="text/javascript">
var targetText = document.getElementById("target").firstChild.data
</script>

 

The text in the textarea will then be contained in the javascript variable 'targetText'

 

thanks for the help......

you have given the code to get the whole text from the text area...

But i want to access the selected text from the text area.

for example...

in java we can get the selected text form the text area as...

suppose the textarea name is area then,

 

string selectedText=area.getSelectedText();

 

i think this will be the function in java ,but i m not sure...

 

i have just given the example of the java

 

I'm not a java programmer, so I don't know what it looks like. But the above sure looked like javascript to me. That's where my confusion arose - I don't know if you are talking about javascript or java. Which one are you talking about?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.