Skip to content

Instantly share code, notes, and snippets.

@fizerkhan
Created April 12, 2012 03:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fizerkhan/2364466 to your computer and use it in GitHub Desktop.
Save fizerkhan/2364466 to your computer and use it in GitHub Desktop.
I'd like to double click this td element and have #heythere toggle too
HTML
----
<table class="table table-striped">
<tbody>
<tr class="diary_hour"><!-- Hour Row Start -->
<td class="span1" data-toggle="collapse" data-target="#heythere" title="Got a question? Drop us a line.">
<h4>Click Here</h4>
</td>
<td class="test"> <!-- I'd like to double click this td element and have #heythere toggle too -->
<a href="#" class="noaction" data-toggle="collapse" data-target="#heythere"><i class="icon-eye-open"></i></a>
<div class="collapse" id="heythere">
This div is hidden by default. Click the eye icon or the RHS TD to open it.
</div>
</td>
</tr><!-- Hour Row End -->
</tbody>
</table>​
Javascript
-----------
$(function(){
$(".test").dblclick(function(event) {
event.preventDefault();
alert("Click!");
$("#heythere").collapse('toggle');
});
});
CSS
----
.test {
border: solid 1px;
}​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment