I need to add a beep to my script. I add every time a sound should be.
$("#beep").html("<embed src='button-16.wav' hidden='true' autostart='true' loop='false' id='bp' />")
But when I add, my lost focus.
I tried to focus it again in the following ways.
1)
$("#beep").html("<embed src='button-16.wav' hidden='true' autostart='true' loop='false' id='bp' />");
$("#txt").focus();
2)
$("#beep").html("<embed src='button-16.wav' hidden='true' autostart='true' loop='false' id='bp' />");
$("#bp").ready(function(){
$("#txt").focus();
});
But neither the first nor the second method works.
HTML code
<div id="beep"></div>
<input type="text" id="txt" />
So, how can I keep the focus of the text field after the beep?
source
share