0

colorthumbs[i].addEventListener('click', function(){
    var colorcode = this.getAttribute('colorcode');
    var thumbimg = document.getElementById('productthumbs').getElementsByTagName('img');
    for(var i = 0; i < thumbimg.length; i++) {
 <div id="colorpanel" style="border-bottom:1px solid lightgray;">
     <p><b>Select Color</b></p>
     <div class='productthumbs'>
         <img class="thumbimg" src="Images/p1s1c1.jpeg"  alt="color1" colorcode="1" selected="selected" style="border-color:brown;"/>
     </div>
</div>

This has to be xhtml strict 1.0 only nothing else. been working on a ton of errors and now down to these last three.

Line 83, Column 92: there is no attribute "colorcode" Line 83, Column 105: there is no attribute "selected" Line 117, Column 94: there is no attribute "tabIndex"

bencripps
  • 2,025
  • 3
  • 19
  • 27
Wilfredo Turner
  • 71
  • 1
  • 11

2 Answers2

1

There is no attribute in HTML called "colorcode", where did you get colorcode="1"? The selected attribute is not for the img tag, it is meant for a drop down menu. Remove both of these from your img tag.

I see nothing in your code about tabindex but I suspect it is because you capitalized the "I" in index. XHTML is case sensitive, so element and attribute names are generally lowercase.

Fix all three of these and your code should work.

kojow7
  • 10,308
  • 17
  • 80
  • 135
0

You are attempting to use attributes in HTML that do not exist.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img

If you would like to add custom attributes to your code, maybe try this: Can I add custom attribute to HTML tag?

Community
  • 1
  • 1
Kiith Nabaal
  • 366
  • 2
  • 5
  • 16