dimanche 21 août 2016

How to add different ID on same CLASS name?

What I would like to accomplish. I have a checklist in a website, and I want to add one more on button click (similar like in trello card). Because it is a lot of htlm I would like to add it from external html file. But I want different ID with each addition. Every id should look like id name and number.

Hope it is clear.

Here is the code:

$('.new-checklist').on('click', function(e){
  e.preventDefault();
  $.get('new-chk.html',function(data) {
    $('.checklist').append(data);
    $('.checklist-all').attr("id", "chk");
  });
  return false;
}); 




Aucun commentaire:

Enregistrer un commentaire