Skip to content

Instantly share code, notes, and snippets.

@venkatd
Created November 3, 2011 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save venkatd/1337120 to your computer and use it in GitHub Desktop.
Save venkatd/1337120 to your computer and use it in GitHub Desktop.
jquery data lost for onunmatch
<!DOCTYPE HTML>
<html>
<head>
<title>
</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.entwine.js"></script>
<script type="text/javascript">
$('.test').entwine({
onmatch: function() {
this.data('name', 'foo');
},
onunmatch: function() {
alert('onunmatch ' + this.data('name'));
},
onclick: function() {
alert(this.data('name'));
}
});
$('.remove').entwine({
onclick: function() {
$('.test').remove();
}
});
</script>
</head>
<body>
<a class="test" href="#test">
click
</a>
<br/>
<a class="remove" href="#test">
remove
</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment