Change modal element after loaded - WP JS jQuery

Asked

Viewed 33 times

0

Good, find someone to help me understand this dilemma.

I have a modal that is loaded from a click on a link and shows the information of a given course. So far everything is right and working.

However, after this modal is already loaded and displaying the values, I want to change the title text for example (H2). If I run the change code via console everything works correctly. But not automatically, so I figure it’s a loading order or something. I have tried all the options below unsuccessfully. Any suggestions?

  /* TESTE 1 */
    jQuery(document).on('click','.mec-monthly-tooltip', function(){

        jQuery("h1.mec-single-title").html('Novo Titulo');
        alert('Teste 1');
    });


  /* TESTE 2 */
    jQuery('.mec-calendar-day h4.mec-event-title').bind('click', function(e) {

        $(this).one("ajaxStop", function() {
            jQuery("h1.mec-single-title").html('Novo Titulo');
            alert('Teste 2');
        }); 
    });
    
  /* TESTE 3 */
    jQuery(document).on('click','.mec-monthly-tooltip', function(){

        jQuery("h1.mec-single-title").html('Novo Titulo');
        alert('Teste 3');
    });
    
  /* TESTE 4 */
  jQuery('h1.mec-single-title').bind('load', function() { 

        jQuery("h1.mec-single-title").html('Novo Titulo');
        alert('Teste 4');
    });
    
  /* TESTE 5 */
    jQuery(window).load(function(){

        jQuery("h1.mec-single-title").html('Novo Titulo');
        alert('Teste 5');
    });

  • I would say that the best strategy would be to put an Event Listener in the modal. But without other details (as if the modal HTML code is already in the DOM or if it is loaded dynamically), is it difficult to elaborate a more complete answer? Could you give us a little more detail to help us find a solution? Maybe share HTML code on jsfiddle?

  • Unfortunately I do not have access to the code that generates the modal, is a wordpress plugin. On this page you have the calendar (go to the month of December and click on the event) to view the modal. groupsd.pt/senses-dynamics/formation - I need to change that title. My code on the console works, I’m not able to intercept when fashion is loaded to make the change

1 answer

0


As I couldn’t get any Solution via JS or Jquery, a colleague Gave the tip to Hide via CSS the first 4 Elements and it worked.

body h4.mec-event-title {
   text-indent: -32px;
}

Browser other questions tagged

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