Created
January 16, 2012 14:14
-
-
Save wflanagan/1621051 to your computer and use it in GitHub Desktop.
How do I get the value of a clicked span in JQuery?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> $(".todo_points").click(function () { var tod...d.split("_"); console.info(this.text()); }); | |
[span#todo_points_4f0f429ef96f7a1b8e000002.todo_points, span#todo_points_4f0f5e72f96f7a24f8000001.todo_points, span#todo_points_4f122bf9f96f7a6af8000035.todo_points] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".todo_points").click(function () { | |
var todo = this; | |
an_id = this.id.split("_"); | |
console.info(this.text()); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="4f122bf9f96f7a6af8000035" class="todo item_box"> | |
<div class="todo_icon_box"> | |
<img src="https://secure.gravatar.com/avatar/417e25057ef43a75d77cc403239040a2.png?r=PG&s=30" alt="417e25057ef43a75d77cc403239040a2"> | |
</div> | |
<div class="todo_info_box"> | |
<span id="todo_points_4f122bf9f96f7a6af8000035" class="todo_points">1</span> | |
<span class="todo_due">01/18 </span> | |
<span class="todo_status"> A</span> | |
<span class="todo_user">@whiskey</span> | |
<span class="todo_description">Look At Whether We Can Get Our Products In Etsy</span> | |
<br><br>Reference: <a href="/projects/241/contacts/4ec5742ef96f7a6de90008b1">Etsy</a> | |
</div> | |
<div class="todo_action_box"> | |
<a onclick="showDialog('Todo Detail',this.href); return false;" href="/projects/241/todos/4f122bf9f96f7a6af8000035">Show</a> | |
<a onclick="showDialog('Reassign',this.href); return false;" href="/projects/241/todos/4f122bf9f96f7a6af8000035/reassign">Reassign</a> | |
<a onclick="if (confirm('Are you sure?')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', 'authenticity_token'); s.setAttribute('value', 'nZWQuaE0rldwTjIC/CyiE45Lunk/1m/TvxmZymiZ+78='); f.appendChild(s);f.submit(); };return false;" href="/projects/241/todos/4f122bf9f96f7a6af8000035/complete">Complete</a> | |
<a onclick="if (confirm('Are you sure?')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', '_method'); m.setAttribute('value', 'delete'); f.appendChild(m);var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', 'authenticity_token'); s.setAttribute('value', 'nZWQuaE0rldwTjIC/CyiE45Lunk/1m/TvxmZymiZ+78='); f.appendChild(s);f.submit(); };return false;" href="/projects/241/todos/4f122bf9f96f7a6af8000035">Delete</a> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment