Ho questo div
codice:
<div id="scheda" data-scheda="205">
che deve essere richiamato via jquery e ogni volta ha un contenuto diverso in base al numero che ha in data-scheda.
E fino a qui va bene, il problema sorge quando devo verificare l'esistenza di tale div con tale attributo per non creare doppi o per farlo chiudere e aprire quello con un altro numero per data-scheda ho provato vari modi:
e il div non si apre proprio
codice:
var dataScheda = $(this).data('scheda');
if ($('#sch01-take, [data-scheda='+dataScheda+']').length==0) {
senza virgola, il div si apre ma non gli importa quale sia il data-sheda
codice:
var dataScheda = $(this).data('scheda');
if ($('#sch01-take [data-scheda='+dataScheda+']').length==0) {
oppure così, idem come sopra
codice:
if ($('#sch01-take[data-scheda='+dataScheda+']').length==0) {
anche così
codice:
var dataScheda = $(this).data('scheda');
var dataSchedaDefine = $('#sch01-take').data('scheda')
if ($(dataSchedaDefine).length==0) {
Dove sbaglio? Oppure c'è un altro modo?
Helpppp grazie