Change <a> tag text via Jquery

Asked

Viewed 57 times

0

I have a pop-up that generates the following html code:

<a data-val-filinkbutton-type="button" href="#" id="AtribuicaoCodigo_lnkPop" onclick="openDialog(event, this, 'AtribuicaoCodigo_pop');">Regra:</a>

I need to change the text of Regra: according to the value of a dropdown that is on the back screen, ie in Parent. I made the following code jquery:

$(function () {
    $('#btnCopiar').on('click', function (e) {
        if (parent.$('#TipoAtribuicao').val() === '1') {
            $('#AtribuicaoCodigo_lnkPop').text('Comissionado: ');
        }
        else {
            $('#AtribuicaoCodigo_lnkPop').text('Regra: ');
        }
        openDialog(event, this, 'popCopiar', null, 800, 750);
    });
});

But nothing happens, it’s not changing the name, someone can tell me why?

  • @Sam yes.......

  • @Sam is a popup

  • @Sam but it’s right, this way (Parent) the value is coming correctly, the only thing that is not happening is the exchange of the text "Rule" pop up....

  • From what I understand you are changing the text of the tag "a" before it exists, try to do this after the modal is opened, via callback, timer or something else.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.