javascript - durandal messagebox close button on top -


The default message is similar to the box box: and it's named: messagebox.html < / P>

  & lt; Div class = "message box" & gt; & Lt; Div class = "modal-header" & gt; & Lt; H3 data-bound = "html: title" & gt; & Lt; / H3 & gt; Z & lt; / Div & gt; & Lt; Div class = "modal-body" & gt; & Lt; P class = "message" data-bind = "html: message" & gt; & Lt; / P & gt; & Lt; / Div & gt; & Lt; Div class = "modal-footer" data-bind = "foreach: option" & gt; & Lt; button class = "btn" data-bind = "click: function () {$ parent.select option ($ data);}, html: $ data, css: { 'btn-primary': $ index () == 0 , Autofocus: $ index () == 0} "& gt; & Lt; / Button & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

Now here, I would like to put the X button on the top right:

   

So I put the x in the model-header, but I can not understand where and what code to write, so when the user clicks X, the popup is off Will go

Message Box. JS like this:

  defined (function () {var message box = function (message, title, options) {this.message = message; this.title = title || message box . Difolttitl; this.options = options || Sndeshbaks. default option;}; MessageBox.prototype.selectOption = function (Snwadrekha) {this.modal.close (dialogResult);}; MessageBox.defaultTitle = ''; the message box .defaultOptions = ['OK']; Return messagebox;});  

function need to force the knockout for closing modal

< Pre> & lt; Div class = "modal-header" & gt; & Lt; H3 data-bound = "html: title" & gt; & Lt; / H3 & gt; & Lt; Span data-bind = "click: function () {$ parent.close ()}} gt; X & lt; / div & gt;

while the look of your JS file like:

  define (function () {var message box = function (message, title, options) {this.message = message; this.title = title | | MessageBox.defaultTitle; this.options = options || message box. The default option;}; Sndeshbokskprotitipksektopshn = function (dialog result) {this.modal.close (dialogue results);}; Sndeshbokskprotitipkkojh = Function () {this.modal.close ();}; MessageBox.defaultTitle = ''; MessageBox.defaultOp Tions = ['OK']; back message box;});  

Comments