Here is a scenario: From create.jsp, I am creating a play button and an audio tag as follows:
//play button
out.write("<input type=\"button\" id=\"playButton\" value=\"Play Now\" >");
out.write("");
//audio element
out.write("<audio id=\"sound\" preload=\"auto\">");
//out.write("<source src=\"sfl\" type=\"audio/ogg\" />");
out.write("<source src=\"sfl\" type=\"audio/mpeg\" />");
out.write("Your browser does not support the audio element.");
out.write("</audio>");
I used a frame to bring this to home.jsp as follows:
<iframe id='bgframe' style='display:compact;' src='create.jsp' width="400" height="200"></iframe>
In my jquery code, I have
$("#playButton").click(function(){
alert("Play button clicked");
}
But nothing happens when I click the playButton.
Question: How can I use jquery or javascript to capture click event on playbutton deployed via a frame?