javascript - Finding clicked item from a span using jquery -


I have to follow HTML, for example I'm trying to find the item I clicked on: For example: O / P should be in that way. I wrote it like this, but what I am not getting is needed. It sends all the text back to

  $ (' Emotion-less .text '). ('Click', function (e) {var str = $ ('. Sense-text .text'). 'Span'). Text (); Alert (str);}); This is the HTML code I am trying to make. After this I have written the above code, but I am getting the complete text, but only I did not find the item that I clicked  
  & lt; Div class = "emotion-less" & gt; & Lt; Div class = "wrapper" & gt; & Lt; Div class = "key" & gt; & Lt; / Div & gt; & Lt; Div class = "text" style = "cursor: indicator;" & Gt; & Quot; Div class = "tag alerts-success" & gt; & Lt; A href = "#" class = "close" data-rejected = "alert" & gt; × & lt; / A & gt; & Lt; Span class = "noun" & gt; Thumbs & lt; / Span & gt; & Lt; Span class = "adverb" & gt; Up & lt; / Span & gt; & Lt; Span class = "verb" & gt; Up & lt; / Span & gt; & Lt; Span class = "verb" & gt; Down & lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "clear-sense" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

You use this for context and goal Requires the duration in the selector .

  $ ('emotion-text, text duration'). ('Click', function (e) {var str = $ (this) .text (); warning (str);});  


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -