jeudi 9 janvier 2020

if span text (inside iframe) equals a text div block

How can this work if the span element is inside an iframe? the code bellow is working

  • **How can this work if the span element is inside an iframe?*

$(document).ready(function() {
  if ($("span#lblConfirmacao").text() == "Quero mudar para corrente") {
    document.getElementById("b-conta").style.display = "block"
  } else {
    document.getElementById("a-conta").style.display = "block"
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

<div style="margin-top: 0rem; width: 70%;"> 
 <label id="lblChk" title="Marque para confirmar a alteração">
  <input id="chk" name="chk-prospects" type="checkbox">
   <span id="lblConfirmacao">Quero mudar para corrente</span>
 </label>
</div>



<div id="b-conta" style="display:none;">
  <p style="font-size: 13px;">
    <strong>Atenção:</strong> A partir da alteração do modelo.
  </p>
</div>
<div id="a-conta" style="display:none;">
  <p style="font-size: 13px; color:#C3C;">
    <strong>Atenção:</strong> Nesse tipo de modelo.
  </p>
</div>

Aucun commentaire:

Enregistrer un commentaire