Hi All
I have been at this for quite some time now and finally decided to ask the question.
Been using http://api.jquery.com/each/ and https://www.laserfiche.com/support/webhelp/Laserfiche/10/en-us/administration/Default.htm#../Subsystems/Forms/Content/Javascript-and-CSS/Customizing%20Tables.htm#IteratingoverTableRows
to try and figure out how to prevent an end user from pressing a specific key on a text field within a table.
I got it right on a single field using:
$(document).ready(function() { // Stop user to press enter in textbox $("input:text").keypress(function(event) { if (event.keyCode == 13) { event.preventDefault(); return false; } }); });
But now I cannot seem to win the iteration war. I still get it to work on the first row using:
$(document).ready(function() { cantpressenter(); $('.onceofftable tbody tr').on('keypress', cantpressenter); function cantpressenter(){ $('.onceofftable tbody tr').each(function () { $(this).find('.OnceOffDescription').each(function () { if (event.keyCode == 13) { event.preventDefault(); } }); }); } });
What am I doing wrong :O!?
Please help! Thanks in advance.