php - Need properties to pass to google chart javascript -
i working wordpress checked if typical wordpress question, usual php , jquery question.
i have piece of code executed 12 times different data. have collect data jquery , pass widget shown if click widget clicked. other widget must show data of clicked widget , present google chart. show on purpose , google chart thing no problem, problem pass data. tried lot of things new jquery , have lack of skills @ moment hope guys can me. have simplified code show examples , structure.
the code executed 12 times:
<a href="javascript:void(0);" class="span1 <?php echo $color .' '. $stylename; ?>"> <div class="box_top"> <div class="icon"></div> <div class="title"><h2><?php echo $title; ?></h2></div> </div> <div class="box_middle"> <?php echo $currentvalue; ?> </div> <div class="box_bottom"> <div class="lastweek"> <p>last week:</p> </div> <div class="number"> <?php echo $prevvalue; ?> </div> </div> </a>
the difference between widget , other widget in class span1 span5.
to make long story short: need collect data of variables can pass them widget, can me or push me in right direction?
you can select values straight html better use jquery data.
html
<a href="javascript:void(0);" data-current="<?php echo $currentvalue; ?>" data-prev="<?php echo $prevvalue; ?>" data-title="<?php echo $title; ?>" class="span1 <?php echo $color .' '. $stylename; ?>"> <div class="box_top"> <div class="icon"></div> <div class="title"><h2><?php echo $title; ?></h2></div> </div> <div class="box_middle"> <?php echo $currentvalue; ?> </div> <div class="box_bottom"> <div class="lastweek"> <p>last week:</p> </div> <div class="number"> <?php echo $prevvalue; ?> </div> </div> </a>
jquery
$('body').on('click','.span1',function(){ var title=$(this).data('title'); var cur=$(this).data('current'); var prev=$(this).data('prev'); alert(title+': '+prev+' - '+cur); });