Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8989255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:12:44+00:00 2026-06-15T22:12:44+00:00

I’m trying to get a Bootstrap modal to load via ajax some html that

  • 0

I’m trying to get a Bootstrap modal to load via ajax some html that creates a modal. This html will have jPlayer in it.

I absolutely cannot get the buttons to work for the audio in the modal no matter what I try.

Here’s how I’m loading the modal:

$(document).ready(function() {
    $(".createmodal").click(function(){
        $('<div class="modal hide fade"> ..modal html.. </div>').modal();
    });
});                                      

​

Here’s the example in jsfiddle — I skipped the ajax and just loaded the html straight into the modal creation.

I’ve tried using jquery’s .load method.

JSFiddle: http://jsfiddle.net/R5UDn/

Edit: I’ve tried putting the jplayer initialization in the modal code… the audio fires if I use autoplay, but the controls do not work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:12:46+00:00Added an answer on June 15, 2026 at 10:12 pm

    I redid your code as an AJAX call in Plunker, and it seems to work for me (Chrome, FF):

    Plunker

    I made it so the body of the page now includes a modal directly and loads an html AJAX response (modal-jplayer.html) into the .modal-body via the data-remote attribute. The script to activate the jPlayer is appended to the modal-jplayer.html.

    HTML

    <a class="btn" data-target="#myModal" data-remote="modal-jplayer.html" data-toggle="modal">Launch Modal</a>
    <div id="myModal" class="modal hide fade">
      <div class="modal-container step-1">
        <div class="modal-header icon">
          <button type="button"class="close"data-dismiss="modal"aria-hidden="true">&times;</button>
          <h4></h4>
        </div>
        <div class="modal-body">
        </div>
      </div>
    </div>
    

    modal-jplayer.html

    <div id="jquery_jplayer_1"class="jp-jplayer"></div>
    <div id="jp_container_1"class="jp-audio">
       ...
    </div>
    <script>
      $("#jquery_jplayer_1").jPlayer({
        ready: function(event) {
          $(this).jPlayer("setMedia", {
            mp3: "http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3",
            oga: "http://www.jplayer.org/audio/ogg/TSP-01-Cro_magnon_man.ogg"
          });
        },
        swfPath: "http://www.jplayer.org/2.1.0/js",
        supplied: "mp3, oga"
      });
    </script>
    

    I don’t really know how that compares to what you have in your actual development code – I just did it the way I might do it.

    Otherwise, something that might be causing an issue could be the auto-focus which the Modal plugin employs. That can be disabled rather simply:

    $('body').on('shown','.modal', function() {
      $(document).off('focusin.modal')
    });
    

    But like I said, as of now, it works for me in the Plunker demo without having to use this workaround.


    Just a recommendation for future posts: If you’re using AJAX then please take the time to prepare a comparable AJAX example in either JSFiddle or Plunker, or whatever you prefer. JSFiddle supports AJAX via GitHub Gists. Personally I prefer Plunker for anything AJAX because it supports multiple files directly in the app.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.