Doubt TD Jquery

Asked

Viewed 34 times

0

I’d like to reclaim the name of a class of a TD, follows my code.

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

return of this is n.fn.init {}

because I would like you to return a string with the class name for example

day Calendar-day-2016-03-27 Calendar-Dow-0


I’ll explain better,

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 this date that is appearing on the console, but I can’t get that I need to know how to do =)

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

follow a print with the console return.

inserir a descrição da imagem aqui

  • Can you complete/[Edit] the question? hints that you’re in the middle. You can explain better what you mean by "class"?

  • Do you want to recover the class name of the TD on what type of event? By clicking on this TD?

2 answers

0

I don’t know if it’s what you’re looking for, but try adapting your code to it with jQuery:

$("seu_elemento").attr("class");

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.