Answer the question
In order to leave comments, you need to log in
How to pass values from element to js function?
Good day,
I got stuck on passing my parameters to the js function.
<?php foreach ($photos as $photo): ?>
<?php
$items[] = ['content' => '<div class="col-md-3 col-sm-4 col-xs-6 thumb">
<img class="img-responsive" data-id="1" data-sort="13" src="'.Yii::$app->request->hostInfo.'/uploads/thumbnails/'.$photo->name.'" width="150px"/></div>'];
?>
<?php endforeach; ?>
//я вывожу в витжет свои картинки, где перетаскивая их вызываю sortgallery( ) вот в нее то я и хочу передать свои data-//id и data-sort
<?php echo Sortable::widget([
'type'=>'grid',
'pluginEvents' => [
'sortupdate' => 'function() { sortgallery(); }',
],
'items' =>$items,
]);?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question