Set innerHTML of Span in Modal

Daniel Pineault
Daniel Pineault used Ask the Experts™
I'm trying to open a modal and then set the innerHTML of a span, but can't seem to get it working.

The modal is

            //'header'=>'<h4>Add a New Company</h4>',
            //'headerOptions' => ['id' => 'modalHeader'],
            'header' => '<span id="modalHeaderTitle"></span>',
            'headerOptions' => ['id' => 'modalHeader'],
            'closeButton' => [
                'class'=>'btn btn-warning pull-right',
            'clientOptions' => [
                'backdrop' => 'static', //true,
                'keyboard' => false, // true,
        echo '  <div id="modal-system-messages" style="opacity: 1; display: none"></div>';
        echo "<div id='modalContent'></div>";

Open in new window

And then my js for the calling button is

        function (){
            //Open the modal window
			// Set the modal title span
			// alert($(this).attr('title'));
			$('#modalPopup #modalHeader #modalHeaderTitle').innerhtml = '<h4>' + $(this).attr('title') + '</h4>';

Open in new window

I have validated that alert($(this).attr('title')); is returning the proper value but the .innerHTML line does nothing.

Thank you for your help.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2014
references :

$('#modalPopup #modalHeader #modalHeaderTitle').html('<h4>' + $(this).attr('title') + '</h4>');

Open in new window

Daniel PineaultPresident / Owner CARDA Consultants Inc.
Distinguished Expert 2018


Thank you.  I was sure I had already tried that, but apparently not.  Thank you for the links.  I will take some time tomorrow to look them over and try to get up to speed properly.  Thank you once again, your help was greatly appreciated!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial