This is my HTML div tag
<div class="modal modal-success" id="myModal">
I want to add or remove class dynamically using jQuery. I want to match only the the model-*
( eg model-success , modal-danger etc ) part and remove that part whenever want
For example
<div class="modal " id="myModal">
$('#myModal').addClass("modal-"+messageType);
//message type will be success , warning
After adding that I want to remove that newly added part dynamically
<div class="modal modal-success " id="myModal">
I want to keep the modal
part as it is and remove the modal-sucess
part
How can I do this using jQuery?