Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot use <label for="unique-id"> becuse html is cloned #252

Open
GeKVe opened this issue Jan 15, 2018 · 0 comments
Open

cannot use <label for="unique-id"> becuse html is cloned #252

GeKVe opened this issue Jan 15, 2018 · 0 comments

Comments

@GeKVe
Copy link

GeKVe commented Jan 15, 2018

because the nature of vex.open() is to clone content passed in unsafeContent, one cannot use content placed in DOM by template engines. an option for remove+restore original would be one way to fix it

in this (pseudo-code) example <label> elements does not work:

<html><body>
  <div class="hidden-form-html" style="display:none;">
    <form>
      <input id="unique-input-id"/ type="checkbox" name="confirmed" value="1">
      <label for="unique-input-id">Click here to confirm</label>
    </form>
  </div>
</body></html>

<script>
  var html = $('.hidden-form-html').html();
  // Open form in a popup
  vex.open({
    unsafeContent: html,
    afterOpen: function() {
      initForm(this.contentEl);
    }
  });

  var initForm = function(formWrapper) {
    // code for form validation + submit here
  }
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants