0

I am using drag and drop to drag an item with a data attribute of "input". I have a class variable called Input that I want to access. What I want to do is get the data attribute and put it in a variable to access the class variable. This is my code

jQuery($ => {

      var Forms = {

        Init : function()
        {

          this.ConfigDrop()
          this.AddTypes()
        },

        ConfigDrop: function()
        {
          $(".builder-list-item").draggable({ revert: true });
          $(".DropZone").droppable({
            drop: function(event, ui) {
              Forms.AddField(ui)
            },
            over: function(event, ui) {
                $(this).css('background', '#acafb5');
            }
          })
        },
        AddField : function(Type)
        {
            Field = Type.draggable[0].getAttribute("data-Type")
            console.log(Field)


        },
        AddTypes : function()
        {
          this.Input = new Input()
        }
      }

      Forms.Init()


      })

In the AddField method I get the data attribute, which is "Input" and store it in a variable. I can't see a way to use it to access the variable this.Input. Is there a way to use the data attribute to access the class variable?

user3098629
  • 175
  • 1
  • 1
  • 13

0 Answers0