Question

I try to update the color of a shape but it does not change (although F12 says, that the attribute is updated)

 <transform scale="10 10 10" onmousedown="$('#matT').attr('diffuseColor', '0 0 1');">               
      <shape def="boxshape11">
           <appearance def="boxApp11">
                 <material id="matT" diffuseColor="1 1 0" specularColor=".5 .5 .5" />
            </appearance>
            <box def="box1" />
       </shape>
  </transform> 
Was it helpful?

Solution

Using prop instead off attr solves the problem

 <transform scale="10 10 10" onmousedown="$('#matT').prop('diffuseColor', '0 0 1');">               
      <shape def="boxshape11">
           <appearance def="boxApp11">
                 <material id="matT" diffuseColor="1 1 0" specularColor=".5 .5 .5" />
            </appearance>
            <box def="box1" />
       </shape>
  </transform> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top