Changing innerHtml trough p5

#1

Is p5 capable of changing the innerHTML of an html element?I know that you can change the value trough select(#something).value(); but is there an equivalent to this function for changing innerHTML

1 Like
#2

p5js.org/reference/#/p5.Element/html

#3

Thanks for the reply but I am asking about a pre established html element that was not created in the p5 sketch, because I need to apply css to it

#4

You have already answered that in your 1st post:

Function select() returns a p5.Element wrapper for the searched Element:
p5js.org/reference/#/p5/select

Just switch p5.Element method value() to html() this time.

1 Like
#5

For CSS, I believe the p5.Element::style() method would be much more appropriate & practical:
p5js.org/reference/#/p5.Element/style

1 Like
#6

Thanks a lot for the quick answer ! Your suggestion solved my problem if you can call it one, it also cleared up a lot of the misunderstandings I had about the DOM manipulation.You were of great help and I really appriciate it. Keep up the great work

1 Like