JQuery UI modal tests

modal

by toubia95

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/themes/base/jquery-ui.css">
<p>Sed vel diam id libero <a class="clic" href="#">rutrum convallis</a>. Donec aliquet leo vel magna. Phasellus rhoncus faucibus ante. Etiam bibendum, enim faucibus aliquet rhoncus, arcu felis ultricies neque, sit amet auctor elit eros a lectus.</p>

CSS

textarea {
  width: 100%;
}

JavaScript

var message = "ma nouvelle règle";
$( "body" ).append(`
<div id="dialog-message" title="Règle à copier"><textarea type="text" id="text-area">${message}</textarea>
</div>
`);
$( "#dialog-message" ).dialog({
      modal: true,
      autoOpen: true,
      buttons: {
      	Copier: function() {
          $( "#text-area" ).select ();
          document.execCommand("copy");
          $( this ).dialog( "close" );
        },
        Fermer: function() {
          $( this ).dialog( "close" );
        }
      }
    });


/*
autoOpen: false,
      height: 400,
      width: 350,
      modal: true,
      buttons: {
        "Create an account": addUser,
        Cancel: function() {
          dialog.dialog( "close" );
        }
      },
      close: function() {
        form[ 0 ].reset();
        allFields.removeClass( "ui-state-error" );
      }
    });
*/