Welcome to the Treehouse Community
Looking to learn something new?
Josh Keenan19,437 Points
Can I write a script that doesn't update a page after a refresh
I want to prank my friend, recently he entered the lottery for the first time and he has been planning how to spend all the money, now we also just moved for university so we are skyping regularly now to stay in touch.
I want to share screens with him and make him think I have won the lottery, but he will ask me to refresh the page to prove it. Is there a way to write a script that changes the value of a specific element on a page and keeps it as that whilst the script runs?
So I open the prize page and it will say for example, 'congrats you have won!' instead of 'bad luck, try again' or whatever.
You could write a function that changes the text to display what you want, then call that function when the page loads:
Not sure if this is something you can use, but it works depending on the page you are loading. Cheers.