|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
varcorb Smarty n00b
Joined: 08 Oct 2014 Posts: 1
|
Posted: Wed Oct 08, 2014 9:22 pm Post subject: Can't Get javascript to work in smarty |
|
|
Hello,
I have a javascript function that works fine in an html file that has a up and down arrow move the curser on a table that is editable.
But when i place it in smarty it doesn't load it. Any Suggestions?
Code: | <script type="text/javascript">
jQuery(document).ready(function(){
$('td').keydown(function(evt){
if(evt.keyCode == 40){
event.preventDefault();
var cellindex = $(this).index()
var rowindex = $(this).parents('tr').index() + 1
$(this).parents('table').find('tr:eq('+rowindex+') td:eq('+cellindex+')').focus()
}else if (evt.keyCode == 38){
event.preventDefault();
var cellindex = $(this).index()
var rowindex = $(this).parents('tr').index() - 1
$(this).parents('table').find('tr:eq('+rowindex+') td:eq('+cellindex+')').focus()
}
})
});
</script>
|
Code: |
<table class="table zebra-style">
<thead>
<td colspan = "9">
Material Takeoff
</td>
<td colspan = "9">
Material to Buy
</td>
<tr>
<th>Note</th>
<th>Part #</th>
</tr>
</thead>
<tbody>
{foreach from=$results item=row}
<tr>
<td id="Part_Note:{$row.Part_Id}" contenteditable="true">{$row.Part_Note}</td>
<td id="Part_Number:{$row.Part_Id}" contenteditable="true">{$row.Part_Number}</td>
</tr>
{/foreach}
</tbody>
</table>
|
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|