-1

This is the first time i have this issue and i don't understand why. I have a trigger click() with Jquery like this :

$('.history-element').click(function () {
    console.log("Trigger");
    detailHistory($(this).attr('historyNumber'));
});

This is the element i'm triggering :

<span style="cursor: pointer" class="history-element" historynumber="1">14/09/18 15:19</span>
<i style=" float: right" class="ms-Icon ms-Icon--Accept" aria-hidden="true"></i>

When i try to run a minimal code on JSFiddle that's work, so the issue is about something else but i don't find what ! Do you know what could create a conflict whith onclick ?

Thank's !

EDIT

This is the detailHistory function :

function detailHistory(index){
    var history = Office.context.roamingSettings.get('history');
    $('#historyRecapArea').hide();

    $('#historyExpeditor').html(history[index]['expeditor']);
    $('#historyMessage').html(history[index]['content']);
    $('#recapType').html(history[index]['type']);

    if(history[index]['type'] === "Confirmation"){
        $('#recapConfLabel').html("Message envoyé le :");
        $('#recapDate').html(history[index]['date']);
    }
    else if(history[index]['type'] === "Rappel"){
        $('#recapConfLabel').html("Message configuré le :");
        $('#recapDate').html(history[index]['date']);
    }
    else{
        $('#historyRecapArea').show();
        return;
    }

    $('#historyDetails').show();
}
ebillis
  • 224
  • 1
  • 4
  • 19

1 Answers1

-1

I found the solution thank's to the comments.

I was select .history-elements class before creating them. Now, i just set the click handler after and it's work.

ebillis
  • 224
  • 1
  • 4
  • 19
  • 1
    Please delete this answer - just use the comments under the question for things like this :) – Reinstate Monica Cellio Sep 14 '18 at 14:53
  • @Archer https://stackoverflow.com/help/self-answer – Taplar Sep 14 '18 at 14:58
  • @Taplar I assume you didn't read the question and comments, where this was suggested to him. Anyway, it's a question duplicated almost as much as *"How do I return values from async methods?"* This is not a self-answered question. – Reinstate Monica Cellio Sep 14 '18 at 15:02
  • Regardless, the site does not prohibit users from answering their own questions, as that link reflects. You can dislike how a user gets to the point that they answer their own question, but that doesn't mean the site prohibits it. @Archer – Taplar Sep 14 '18 at 15:03
  • @Taplar - this is a comment, not an answer. I don't see any value in this post whatsoever, as an answer. Do you honestly believe that this would help someone who found this question, with the same issue? – Reinstate Monica Cellio Sep 14 '18 at 15:04