how to add data-toggle and data-target using jquery

JavaScript
$("button").on("click", function(){
  $($(this).attr("data-target")).modal("show");
});
Source

Also in JavaScript: