jQuery - replaceWith() method

0 votes
229 views
added Aug 21, 2018 in jQuery by LC Marshal Captain (25,790 points)

To replace the element with jquery

elem = $('#edit-profile-basic-field-ic-und-0-value');
elem.replaceWith(`
<div class="verified-input-wrapper <?php print $identity_verified ? 'v-true':'v-false'?>">
  ${elem[0].outerHTML}
  <button class="btn btn-danger btn-verified v-false" data-toggle="modal" data-target="#edit-profile-basic-field-identity-documents-modal" onclick="event.preventDefault();">GET VERIFIED</button>
  <button class="btn btn-success btn-verified v-true" data-toggle="modal" onclick="event.preventDefault();">VERIFIED</button>
</div>
`);

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...