How to handle a TD using Jquery

Asked

Viewed 68 times

0

I have a value in a TD and I need to recover it, it is a calendar and every date I click from the calentario there is a different class in each date, I need that when I click on that date I can recover the day month and year of the day that I clicked, i have the following return running this code.

summarizing need to recover that date that is appearing on the console.

var dateSelectClick = $(target); console.log(dateSelectClick);

follow a print with the console return.inserir a descrição da imagem aqui

  • Detail more your question, inform which plugins you are using. I imagine you are using Moment.js, if so then you recover with dateSelectClick.get(0).date.format()

  • Is this calendar a simple datepicker or html? You can give an example of html or indicate which datepicker?

1 answer

0

Try to traverse the object

var objData = $(target);
var dateSelect = "";

$('elemento').click(function(){

 $.each(objData,function(i,e){
    dateSelect = e.data._i; //copia o valor da data para variavel dateSelect
  });

});

Browser other questions tagged

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