I’m sorry if this is very basic, but I’m struggling with this simple velo javascript function.
How do I create a textbox so that a user can input a number, and then I can store that number to do math with it later on?
I’ve tried this code in the dev box:
let container = $w . create ( ‘Container’ , {
id : ‘container’ , // The id of the container
width : 300 , // The width of the container in pixels
height : 200 , // The height of the container in pixels
backgroundColor : ‘#f0f0f0’ , // The background color of the container
borderWidth : 2 , // The width of the border in pixels
borderColor : ‘#000000’ , // The color of the border
borderRadius : 10 // The radius of the border corners in pixels
});
// Add the container to the page
page . add ( container );
// Create a new text element
let text = $w . create ( ‘Text’ , {
id : ‘text’ , // The id of the text
text : ‘This is some text inside a container.’ , // The text content
width : 280 , // The width of the text in pixels
height : 180 , // The height of the text in pixels
fontColor : ‘#000000’ , // The color of the font
fontSize : 16 , // The size of the font in pixels
fontFamily : ‘Arial’ // The font family
});
// Add the text to the container
container . add ( text );
I keep getting the error TypeError: $w.create is not a function.
Help?