Hi,
I'm finishing the development of my time tracker php application.
After working a little with it (It's wonderful having something that suits perfectly your needs) i've noticed it would be a good thing having the possibility to set the number of lines to be shown in each page.
I've put a small editbox that in javascript it sets a cookie when enter key is pressed and then reloads the page to show the changes.
It works perfectly if I put the javascript code in the head of the php document.
But it doesn't work when I put the code inside a js file that is linked in the same head section of the same php document.
The function is this one:
function changeLiniesPerPagina(e)
{
if(e.keyCode == 13)
{
document.cookie = "cookieName="+document.getElementById("lines").value+"; expires=Fri, 31 Dec 2049 12:00:00 UTC; path=/;";
location.reload();
}
}
If I use the "Inspect" option in the browser, I can see the message it appears when the function is located in an external js file is:
VM715 phpfilename.php:27 Uncaught ReferenceError: changeLiniesPerPagina is not defined
at HTMLInputElement.onkeypress (VM715 phpfilename.php:27)
onkeypress @ VM715 phpfilename.php:27
Any idea?
Thank you very much!
What I have tried:
Checked the syntax, put the code snippet in different js files...