Alert not works for the following script?
Alert not works for the following script?
saho
Posts: 16Questions: 11Answers: 0
Why my alert not works for the following code?
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.10.12/css/jquery.dataTables.min.css">
<script type="text/javascript" charset="utf8" src="//code.jquery.com/jquery-1.12.3.js"></script>
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.10.0/jquery.dataTables.min.js"></script>
</head>
<table border="1" align="center" id="example" class="display" width="100%">
<thead>
<tr>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
<th>e</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>3</td>
<td>6</td>
<td>9</td>
<td>7</td>
<td>12</td>
</tr>
</tbody>
<script>
$(document).ready(function()
{
$('#example tbody').click( function () {
alert("test") ;
});
});
</script>
</table>
</html>
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
It appears to work just fine: http://live.datatables.net/yezabuyi/1/edit (I've used
console.log
sincealert
isn't allowed on the live site).Thanks,
Allan
Once again i tested but still it not supports alert but in console it works fine.Is there any otherr approach to use instead of alert
Well as I say the live site intentionally blocks
alert()
. However, on a regular HTML page it would work okay.