I'm trying to get this code to toggle between innerhtml - turn off embedded music. But it doesn't seem to be firing?

The html in question:

<span id="music">
<embed src="http://thewalshgroup.ca/dev/the-nest/music/12_full_prom-night_0132.mp3"autostart="true" loop="true"
width="2" height="0" id="player"> <noembed> <bgsound src="http://thewalshgroup.ca/dev/the-nest/music/12_full_prom-night_0132.mp3"> </noembed>
</embed> 
</span>

and the jquery function:

$(document).ready(function() {

var playing = true;

$('#music_control').click(function() {

      if (playing == false) {
       alert('false');
          $('music').html("<embed src='http://site.com/dev/link/music/12_full_prom-night_0132.mp3'autostart='true' loop='true'
width='2' height='0' id='player'> <noembed> <bgsound src='http://site.com/dev/link/music/12_full_prom-night_0132.mp3'> </noembed>");
          playing = true;
          $("#music_control").text("MUSIC ON");

      } else if (playing == true) {
       alert('true');
         $('music').html("<embed src='http://site.com/dev/link/music/12_full_prom-night_0132.mp3'autostart='false' loop='true'
width='2' height='0' id='player'> <noembed> <bgsound src='http://site.com/dev/link/music/12_full_prom-night_0132.mp3'> </noembed>");

        playing = false;
        $("#music_control").text("MUSIC OFF");
      }

  });
}); 

Care to share your solution to help others?

Sure! Sorry about that!

For the jquery, I put:

$(document).ready(function() {

var playing = true;


$("#music_control").click(function(){


        if (playing == false) {
        playing = true;

          $('#music').html(" <embed src='http://url.com/dev/music/12_full_prom-night_0132.mp3' autostart='true' loop='true' width='2' height='0' id='player'> ");




          $("#music_control").text("MUSIC OFF"); 



      } else if (playing == true) {
      playing = false;

         $('#music').html("<!-- asdf -->");


        $("#music_control").text("MUSIC ON"); 

      } 


  }); 



}); 

and in the html I had a link control and the div to switch:

<a href="#" id="music_control" class="">MUSIC OFF</a>


<div id="music">
    <embed src="http://url.com/dev/music/12_full_prom-night_0132.mp3"autostart="true" loop="true"
width="2" height="0" id="player">
    </embed> 
</div>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.