Calculator interface/OOP calc project jQuery

Hello, I’m currently building a calculator interface using jQuery and have been running into issues creating my buttons. I was able to build a function to add buttons to the calculator dynamically and was able to successfully create individual buttons, however when I try to create the number buttons using jQuery.each the text displayed on each button is [object HTMLdocument] and I’m unsure how to find a work around. I’ve done a bit of googling and haven’t found any resolution as of yet. If anyone is able to help alleviate my issues or even point me in the right direction, it would be a huge help!

Here’s the link to my codepen project: https://codepen.io/tazmancooks/pen/dyMPOLr

Apologies if this isn’t articulated well, not all that familiar with jQuery as of yet, any help is greatly appreciated!

Thanks,
Quentin.

down at the end of your code …
$.each(‘7894561230.’.split(‘’), (itm) => {
addNumberButton(itm.toString())

1 Like

Thank you so much! I’m still fairly new to jQuery so that’s a simple mistake I wouldn’t have caught myself. Much appreciated.

This solved the issue with the numbers not displaying, however it’s displaying the index number of the character rather than the character (number) itself.

sorry
$.each(‘7894561230.’.split(’’), (itm,it) => {
addNumberButton(it.toString())

1 Like

Thanks! Found this out shortly after replying. Really appreciate your help and quick responses :slightly_smiling_face: