Home>

I'm developing an app with Monaca, but I want to use a variable in the contents of the HTML tag to make the operation random, but I don't know what to do.
I want to use a variable inside the tag, such as<div position ="variable"> ;.

Learn more

I thought about learning about "A-frame" for creating WebVR, but when specifying the color, position, and angle of an object

&lt;a-box color = "# 6173F4" width = "4" height = "10" depth = "2" position = "-10 5 -5" rotation = "0 0 45" scale = "2 0.5 3"&gt;


Since it is specified in the tag like this, I do not know how to make it random in such a state.

  • Answer # 1

    I think the

    data attribute is useful.

    Try using the data attribute in jQuery

  • Answer # 2

    Isn't it possible to perform data binding normally because monaca can use the mechanism of Angular?
    I don't know the specifications of "A-frame" ...

    Image is

    <a-box color = "{{data.color}}" width = "{{data.width}}" height = "{{data.height}} "...


    It ’s like that.

    I use img tag instead of a-box tag, but it looks like this
    https://codepen.io/anon/pen/NvyNrW