The use of Javascript correct?
-
Hello!
I wanted to make a whole table row clickable and used this javascript to achieve this:
<script type=”text/javascript”>
jQuery(document).ready(function($){
$(‘.tablepress-id-16’).on( ‘click’, ‘tr’, function() {
var $a = $(this).find(‘a’).last();
if ( $a.length )
window.location = $a.attr(‘href’);
} );
});
</script>I have two questions however.
1. WordPress warns me and says: expected { found window instead on this row window.location = $a.attr(‘href’);. Is this something I should fix?
2. I put this javascript on every page where I display a table. Is there any more effecient way to do this, like link to an external page with the javascript or maybe it doesnt make any difference?
Thank’s in advance!
- The topic ‘The use of Javascript correct?’ is closed to new replies.