Hello everyone,
I'm currently modding the card-sort template and I'm currently stalled.
I'm trying to sort the "cards" above into the columns below. The user is supposed to be able to drag each card into a column once. I'm currently trying to figure out how to check if a column already contains the "card".
Each card has a question id somewhere in their class name, so I'm trying to search for the string in the class names of the children of the column class. I've been googleing a bit and found this suggestion:
stackoverflow.com/questions/3914900/jque...te-contain-substring
I've been trying to realise this so:
Code:
if($(this).closest('items-end-inner').parent().className.indexOf('sgqa') > -1)
{
//do stuff
}
This always returns false. Even if I turn this around with <0 it still always returns false. I'm not sure what I'm doing wrong here. As far as I understand "this" is the class my card is dropped into. I'm trying to make sure it's actually the right one with the closest() method. (originally did it without, but no difference) Then I grab the parent of that and then it should hopefully search in the children for the string.
Maybe something that's complicating this is that the the classes I'm trying to search are not diret children of the parent class, but second degree children. That still doesn't explain why it would always return false.