Announcement

Collapse
No announcement yet.

Script doesn't work on another page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • IncWolf
    commented on 's reply
    Thnk u very much. It's really help me a lot. I see, that I need to learn more about js event handler ))

  • Glenn Vergara
    replied
    Clicking the pagination buttons sends an AJAX request to fetch the next page. So the page does not refresh.

    Where is the insert_nickname element located? Does it get overwritten when the post content returned by AJAX gets loaded and then you add it back?

    Try using the delegated event technique to ensure that the event handler will be processed even if the insert_nickname element is not present at the time the event handler is attached or even if it is removed and added back at a later time.

    Code:
    $('.conversation-content-widget').on('click', '.insert_nickname', function(){
        var text = $(this).html()+", ";
        CKEDITOR.instances['vb-cke-instance-1'].insertHtml(text);
    });
    .

    Leave a comment:


  • IncWolf
    replied
    Glenn Vergara I mean, that script doesn't work on any other page of the topic. For ex: I go to the first page of topic, try to use script and it works; go to the second page and script doesn't work. Refresh the second page and script works again. But when I go to the first page or third page - it doesn't work again.

    Console doesn't signal about any errors, ckeditor instance doesn't change. Scripts don't work properly when I come to another page by click on pagination buttons.

    Leave a comment:


  • Glenn Vergara
    replied
    What page it is not working? Maybe the ckeditor instance id is different? Check the Javascript console for any error that will give you a clue on what is happening.

    Leave a comment:


  • IncWolf
    started a topic Script doesn't work on another page

    Script doesn't work on another page

    Hello everyone!

    Today, I just create some small script, that take name of user and post it in CKEDITOR, that I set in the footer before "end of the document":
    Code:
     $(document).ready(function(){
    $(".insert_nickname").click(function(){
    var text = $(this).html()+", ";
    CKEDITOR.instances['vb-cke-instance-1'].insertHtml(text);
    });
    });
    and it works fine, but when I go on another page, that script doesn't work I really need it, can you say me, what I did wrong? I know, that you not support custom scripts, but can you have any tiny idea? That is not the first one, that doesn't work on another page.
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X