Question: As an example that we have

Name : Abdul Naeem

if we select the Naeem from above so to get Abdul From it.......

is it possible to get the left side words of the selected words

i tried but i have not found this..... can any body help me out of this problem.

i found some tips where it only get the selected words but i need the words on its left side

[Get the Highlighted/Selected text](https://stackoverflow.com/questions/5379120/get-the-highlighted-selected-text)

for example lets consider if an object weighs 30 N. now i want to select the 30, and get the word weighs from it ?? how can i do it in javascript –

Answer: 
Let assume these first : 

> 
> all text in textbox = Abdul Naeem
> 
> 
> currently selected text = ul Naeem
> 
> 
> currently unselected text = Ab
> 
> 
> 

Now, from your question, you only want to get the unselected text right, which is in this case is Ab? Then make three variable like this : 

```
var allText = ... // get it from your textbox value
var selectedText = ... // try to get it using your link location
var unselectedText = allText.replace(selectedText, '');

```

Then you get the unselectedText. Thanks & Regards.
```
<!DOCTYPE html>
<html>
<body>

<p>Click the button to display the array values after the split.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    var str = "Abdul Naeem";
    var res = str.split(" ");
    for(i=0;i<res.length;i++)
    {

    alert(res[i]);
    }
    //document.getElementById("demo").innerHTML = res;
}
</script>

</body>
</html>

```