cxDialog icon indicating copy to clipboard operation
cxDialog copied to clipboard

Not working with checkboxes

Open ponasromas opened this issue 2 years ago • 0 comments

Trying to use this on checkbox with twitter bootstrap:

<input class="form-check-input" rel="confirm" type="checkbox" role="switch" id="2faon" name="2fa" value="1">

Nothing happens... JS part:

// cxdialog
    document.body.addEventListener('change', (e) => {
        const el = e.target;
        const nodeName = el.nodeName.toLowerCase();
    
        if (nodeName === 'input' && el.rel) {

          const rel = el.rel;
    
          switch (rel) {
            case 'alert':
              cxDialog('Hello World<br>I am cxDialog');
              break;
    
            case 'ok':
              cxDialog({
                info: '现在开始使用 <strong>cxDialog</strong>',
                ok: () => {
                  console.log('确定');
                }
              });
              break;
    
            case 'confirm':
              cxDialog({
                info: '现在开始使用 <strong>cxDialog</strong>',
                ok: () => {
                  console.log('确定');
                },
                no: () => {
                  console.log('取消');
                },
              });
              break;
    
            case 'article':
              const opts = {
                info: Array(99).fill('文章内容'),
                buttons: []
              };
    
              opts.info.unshift('<div style="width:9999px;background:linear-gradient(to right,rgba(0,0,0,1) 0%,rgba(0,0,0,0.1) 100%);color:#fff;">超宽内容</div>');
              opts.info = opts.info.join('<br>');
    
              for (let i = 0; i < 9; i++) {
                opts.buttons.push({
                  text: '按钮' + i,
                  callback: () => {
                    console.log('按钮' + i)
                  }
                });
              };
    
              cxDialog(opts);
              break;
    
            case 'text':
              formOptions.info.innerHTML = '<div class="setvalue"><input name="name" type="text"></div>';
              cxDialog(formOptions);
              break;
    
            case 'radio':
              createOptions('radio');
              cxDialog(formOptions);
              break;
    
            case 'checkbox':
              createOptions('checkbox');
              cxDialog(formOptions);
              break;
    
            case 'login':
              cxDialog(formOptions);
              break;
          };
        };
      });

ponasromas avatar Aug 08 '23 13:08 ponasromas