last day (15 days later) » 

1:31 AM
1
A: deny page to refresh if the text box is not empty

20ycoTry this one, by default, page will reload every 5 seconds, but if you fill input - page will stop reloading, but then, if you fill input empty again - page will start reload again every 5 seconds, to avoid this, just remove myTimer inside if( $(this).val().length == '' ) {} Updated: // defin...

 
your answer did not work
 
@pydev works fine if you open console and focus input: jsfiddle.net/nicklev/asknef6y
@pydev try again, updated
 
i tried the code in jsfiddle but even if its not empty it still refresh. then i tried your answer and it make the page refresh very fast
 
@pydev updated again, please check code below
@pydev now code works only on input change or keyup, and if it's empty - page reloads
@pydev here is fiddle, try to change text in input, then fill input empty, and you will see that page reloads: jsfiddle.net/nicklev/asknef6y/9
 
i tried and it did not reload the page at all
 
1:31 AM
@pydev take a look: monosnap.com/file/ftvIK2CaACiJ9uYhd7GWQnF7BrNrM7 , as you can see, if you leave input empty - page reloads ( DOM in console reloads )
 
the text box by default must be empty once the user input a string the page must stop to refresh
 
@pydev please check new version of fiddle and code in my answer
@pydev added some comments to understand how it works
 
i tried your answer it make the page reload that is good but even when the textbox in not empty the page still reload.
 
@pydev by DEFAULT, ON PAGE LOAD, do you need to RELOAD page every 5 seconds? or you need reload page ONLY when you click on input and input empty?
@pydev please check - all works fine: monosnap.com/file/RB7AKpt4R2m7zll5c4xk8XqrUJ5zRA
 
what i need is once the user enter the webpage it automatically reload each let say 60 second unless the user enter an input in the text area opinion then the page stop reload
 
1:31 AM
@pydev take a look at video ( screencast ), it works as you expected
@pydev as you can see on screencast, 'document' in console reloads until input empty, but when i type 'stop reload!' - page stop reloading ( 'document' in console stop reloads )
 
yes i see that is what i exactly want but it still not working with me because the page keep refresh even if the textbox not empty
 
@pydev what browser do you use?
 
i am using google chrome
 
@pydev can you post full code that you past in your project? don't undestand why it doesn't work
 
you mean the hall code of this page ?
 
1:31 AM
@pydev please try this one, more simple and clean: jsfiddle.net/nicklev/asknef6y/40
 
also i tried the last answer but still refresh no matter what. so i think the problem is another place ??
 
@pydev i think yes, please check all of your code, because all my examples works in all browsers that i check, a can't see your project, an think that problem in another place. please upvote my answer but don't check as answer.
@pydev add code to the <head>
 
you mean to add this code to the head section ??
 
@pydev - add this javascript code: jsfiddle.net/nicklev/asknef6y/42 to the <head>, with $(document).ready
 
this was the problem i need it in the head tag
can you help me with another question concerning django ?
 
1:31 AM
@pydev please upvote my answer
@pydev let's look at your another question
 

last day (15 days later) »