Monitor newly loaded tags

Asked

Viewed 18 times

0

my scenario is the following, I have a menu (class="menu") where any link that is clicked on it opens in a div ( div id="content")

the problem is that the links that open inside the content div even using the menu class in the links they do not open inside the divria itself? any idea what it might be?

 $('.menu').on('click', function () {
 $('#conteudo').load(this.href);
 return false;
 });

  --> esses links carrega dentro da div conteudo OK
  <a class="menu" href="pg1.php"></a>
  <a class="menu" href="pg2.php"></a>
  <a class="menu" href="pg3.php"></a>

  <div id="conteudo" > 
  --> esse link nao carrega a pagina 4 dentro da propria div
  <a class="menu" href="pg4.php"></a>
  </div>

I may be mistaken more I believe that jquery does not see the newly loaded class within the div so it does not open within itself. some solution to this?

  • 1

    Utilize $('#conteudo').on('click', '.menu a', function () {&#xA; $('#conteudo').load(this.href);&#xA; return false;&#xA; });

  • ours that obvil, when if this inside the project does not see things simple, more somehow he did not recognize the (.menu a) only recognized the class without the link code (.menu)

  • True. I ended up making a mistake with the .menu a

No answers

Browser other questions tagged

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