views:

41

answers:

2

How to highlight a content located at specific location ?

I want to highlight a contents by location.

for example I have a location value (x,y)=(0,312).Then how to highlight that contents by using js/jquery

A: 
<span id="myspan">Lorem Ipsum is simply dummy text</span>

$(document).ready(function() {
    $('#myspan').click(function() { 
        $(this).append('<span class="myclass">You clicked me</span>');
    });
});
Michael Shimmins
This won't do what you want - I misunderstood your requirement from before the edit.
Michael Shimmins
i want to highlight the text, i want it in iphone application when i tried with mouse over it was working in browser,but i tried it in touch move events it was not working in ipad/ipod..
Anish
Can I suggest you edit your question then to make it a bit clearer. It isn't clear from your question that this is what you're after (especially the highlighting individual words, iPhone etc).
Michael Shimmins
When the user touch and drag the text it should be highlighted sequentially till the user ends his dragging.
Anish
A: 

Wrap every word in a <span> and bind "click" event to every span.

elektronikLexikon
is there any way to do this by mouse positions?
Anish