javascript - Where to put jquery function -
i want make row clickable on
<tbody> <tr class='clickable-row' data-href="{% url "perception:detail" %}" data-turbolinks="false"> <td><a href="{{ object.loan.get_absolute_url }}" data-turbolinks="false">{{ object.loan }}</a></td> <td><b>{{ object.current_balance }}</b></td> <td>{{ object.operation_error }}</td> <td>{{ object.start_date }}</td> <td>{{ object.end_date|default:"" }}</td> <td>{{ object.created }}</td> <td>{{ object.modified }}</td> </tr>
in using example
<tbody> <tr class='clickable-row' data-href='url://'> <td>blah blah</td> <td>1234567</td> <td>£158,000</td> </tr> </tbody> jquery(document).ready(function($) { $(".clickable-row").click(function() { window.location = $(this).data("href"); }); });
so far don't have success in clicking on rows. problem located don't know insert
jquery(document).ready(function($) { $(".clickable-row").click(function() { window.location = $(this).data("href"); }); });
could tell me put 5 last lines?
you should write in file . name script.js . , put in html
<script>script.js</script>
Comments
Post a Comment