Duvida TD Jquery [duplicate]

0

I would like to retrieve the name of a class from a TD , follow my code.

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

return of this is n.fn.init {}

I would like to return a string with the name of the class eg

  

day calendar-day-2016-03-27 calendar-dow-0

I'll explain it better,

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

In short, I need to retrieve that date appearing on the console, but I can not get what I need to know how to do =)

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

follows a print with the return of the console.

    
asked by anonymous 22.03.2016 / 19:59

2 answers

0

I do not know if it's what you're looking for, but try to adapt your code to jQuery:

$("seu_elemento").attr("class");
    
22.03.2016 / 20:15
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
  });

});
    
22.03.2016 / 21:25