Any way to prevent Sortable executing javascript inside rows?
I'm using Sortable with table rows and i'm having problems with it.
In my real life application I'm forced to set javascript inside table cells which is executed on page load.
BUT when I drag a row the javascript on that row is executed again which is not the expected outcome at least for me.
Is there any way to prevent this kind of behaviour when using Sortable?
Example code (On page load three alerts, then when sorting row alerts again):
- <html>
<head>
<title>Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
$(function() {
$("#table").sortable();
$("#table").disableSelection();
});
</script>
<table>
<tbody id="table">
<tr>
<td>
blaa blaa 1
<script type="text/javascript">
alert("ROW 1");
</script>
</td>
</tr>
<tr>
<td>
blaa blaa 2
<script type="text/javascript">
alert("ROW 2");
</script>
</td>
</tr>
<tr>
<td>
blaa blaa 3
<script type="text/javascript">
alert("ROW 3");
</script>
</td>
</tr>
</tbody>
</table>
</body>
</html>