How to dynamically change bootstrap modal body
Try this one:
$('.modalShow').click(function(event){
event.preventDefault();
var e = $(this);
var title = e.data('title');
var body = e.data('value');
$('.modal-title').html(title);
$('.modal-body').html(body);
$('#myModal').modal('show');
});
Please have a look at this fiddle.
Here is the code:
$(function(){
$('.custom-modal').click(function(e){
e.preventDefault();
var mymodal = $('#myModal');
mymodal.find('.modal-body').text('hello');
mymodal.modal('show');
});
})
the simplest solution is - you can use javascript's innerHTML
to change html of your modal body like this -
//get your modal body by class and change its html
document.getElementByClass("modal-body").innerHTML = "<p>some text</p>";