Get the value of an input and save it in a variable with Framework7

1

I'm working on Framework7 and PhoneGap new to me.

I'm in a calendar and I use the library that comes with the default Framework7, so I get the base values with JavaScript and JSON and assign them to input . The problem is that getting the value of input with Framework7 does not get it. I already read the documentation of DOM7 but it does not work for me.

I get the values and assign them correctly:

var cadena = $.getJSON("../www/DB/consultareventos.php", function (data) {
    $.each(data,function (index,elements) {
      var date = (elements.fecha);
      var hora = date.split(' ');
      var fecha = date.split('-');

      año = fecha[0];
      mes = fecha[1];
      dia = fecha[2];
      ho =  hora[1];
      var di = dia;
      var d = di.split(' ');

      n = d[0];
      $('#año').attr('value',año);
      $('#mes').attr('value',mes);
      $('#dia').attr('value',n);
    });  });

<input type="text" name="año" id="año" /> 
<input type="text" name="mes" id="mes" /> 
<input type="text" name="dia" id="dia" />

The code that brings by default that I want to manipulate:

data: function () {
      var date = new Date();
      var year = date.getFullYear();
      var month = date.getMonth();
      var day = date.getDate();
      return {
        today: new Date(year, month, day),
        events: [
          {
            date: new Date(year, month, 30, 10, 30),
            title: 'Meeting with Vladimir',
          },
          {
            date: new Date(year, month, day, 18, 00),
            title: 'Shopping',
          },
          {
            date: new Date(year, month, day, 21, 00),
            title: 'Gym',
          },
          {
            date: new Date(year, month, day + 2, 16, 00),
            title: 'Pay loan',
          },
          {
            date: new Date(year, month, day + 2, 21, 00),
            title: 'Gym',
          },
        ],
      }
    },  

The values of the variables date , month and day I want to replace them with the values of input .

I already tried with jQuery and with JavaScript , but I get undefined values.

    
asked by jor 26.12.2017 в 17:34
source

0 answers