Although the above code fulfills the requirements on the page, But our code is coupled together, At present, although there are not many problems, if SKU attributes become more and more with the change of demand in the future, for example, when one or more drop-down boxes are added to the page, it means selecting the memory of the mobile phone. Now we need to calculate the color, memory and purchase quantity to judge whether NextBTN shows insufficient inventory or puts it into the shopping cart. The code is as follows:
< div id= "showcount" >