Search code examples
javascriptjquerydynamiczurb-foundationabide

Foundation 6 Abide not working with Ajax / Dynamic Html


This problem is really annoying me.

In this simple form:

<form data-abide novalidate method="POST">
  <label>First name
  <input type="text" name="firstname" required> 
  </label>
  <input type="submit" value="Save">
</form>

I'm trying to add a new field and make Foundation check it.

$('<label>Last Name<input name="lastname" type="text" required></label>').insertBefore('input[type=submit]').foundation();

Example here: https://jsfiddle.net/wcLmb3y9/


Solution

  • Found it guys!!!

    Just add a

    Foundation.reInit('abide');
    

    Right after the html you've included and vóila!

    Hope it helps more guys!

    lml