Legalities apart, such behaviour will do your reputation no good at all. Act thoughtlessly and things could backfire on you , so bear the following points in mind.
When and who you tell is a matter of fine judgment. Heads will be a upset if the first they hear of your plans is when they're asked for a reference. Some teachers try to do the whole thing without telling anyone, offering someone unconnected to the school as a referee. But most schools will put in a call to your current head anyway.
Most schools are now supportive of ambitious teachers, so you may get help from colleagues to find the right job.
If you have been successful at interview, let your headteacher or head of department know straight away as plans must be made to replace you.
There is also the matter of when to go. You can leave at Christmas, Easter or summer provided you give notice by the end of October, February or May respectively. If you want to leave at other points in the year, or at unusually short notice, you will need permission from the governors - and in a time of teacher shortage, this is no mere formality.
Hand in your notice in writing to the governors. Your letter doesn't have to be brief and formal. Governors prefer something warmer that acknowledges the contribution the school has made to your development. Deliver the letter personally to the head, and explain what it is. Let the head read it, and ask whether you should post it or leave it to be handed on.
So now you're in limbo - looking ahead to your new job but still in your old one. At this point, you should n't give anything less than your full attention to your work. Your new school will want you to visit at least once during your final term, but with a bit of give and take you should be able to work something out.
In your last couple of weeks, leave nothing undone - mark your books, tidy your resources and sort out your accounts. An incoming replacement might be forced to chase things and make enquiries that could follow you into your new teaching context - and having loose ends hanging around your neck is the last thing you want when you're making a new start.
When you finally bow out, smile and thank everyone. If you have a leaving do, it's good to make a short speech. Be gracious - no sarcasm, no veiled settling of scores, no discordant jokes. Leave nodding heads and grins - and perhaps even a tear of appreciation in the eye.