Defining a text box to input data.

928 views
Skip to first unread message

studi...@gmail.com

unread,
Apr 10, 2017, 9:50:12 AM4/10/17
to Google Web Designer beta
Hi

I need to make a box with option to input a single number in a HTML google ad banner. Depending on the number entered banner would have different endings.
I've tried a few things, and read help and forum but I didn't find any easy way to do this.

Can someone please help with the problem or reefer me to a page where that might be explained or answered.

Thanks
Josip

San Khong

unread,
Apr 13, 2017, 8:00:42 PM4/13/17
to Google Web Designer beta
Google Web Designer does not have built-in 'change' event but this can be done in code. 

Select the element tag in the Tool bar.
Click on custom element and type "input" in the element field
Draw the input element on stage

Right click on the input element on stage and select Add event...

Select Mouse > click > Custom > Add custom action

Add the custom action which is what you want the content to do when there is a change in the input field, for example, I would like the console log to trace the value of the input field when it's changed:

inputContent = document.getElementById('input').value;

console.log(inputContent)

Click ok to save


Now, the click event is triggered instead of change, so you need to go to code view and edit click to change in 2 places:


Now when you switch back to design view, you would see the change event in the events panel and you can edit it to change the action to whatever way you want.


Attached is also the sample Google Web Designer file. 


Hope it helps.

San

Google Web Designer team

 

customEvent.html
Reply all
Reply to author
Forward
0 new messages