$(document).on('change', 'select[name="box"]', function () {
var val = $(this).val();
- var opt = $(this).find('option[value="' + val + '"]');
+ var opt = $(this).find('option:selected');
var i = $(opt).data('index');
- console.log(val, opt, i);
+
$this.boxIndex = parseInt(i);
$this.fluidbook.cache.set('boxindex', $this.boxIndex);
$this.setBox();
},
removeCurrentBox: function () {
- this.boxes.splice(this.boxIndex);
+ this.boxes.splice(this.boxIndex,1);
if (this.boxes.length === 0) {
this.boxes = [{name: 'Box 1', refs: []}];