title: Setting Width to Appended Child Image - VANILLA javascript
body: <p>I built an image slider with jQuery and thought it would be a good exercise to do the same in vanilla javascript (Which is an awesome framework btw ;) ).  It's good to know that though I can build things with jQuery, I have very little understanding of what's actually going on under the hood.</p>
  
  <p>Anyways, here is my problem.  I am trying to set the width of an image that I had appended to a list element.  For some reason, the code I have written is not affecting the width property of the image.  I updated the css as a sanity check and it worked fine, so it must be an issue with the js. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>console.log('Yeh, bitch!  Programming!');
  
  function slider() {
  var settings = {
      width: "700px"
  }; // end settings object
  
  var sliderImages = document.getElementById('slider-images').querySelectorAll('img'),
      prevImg = document.getElementById('prev-img'),
      currentImg = document.getElementById('current-img'),
      nextImg = document.getElementById('next-img'),
      wrapperInner = document.getElementById('img-wrapper-inner'),
      imgList = [],
      imgAttr;
  
  for (var i = 0; i &lt; sliderImages.length; i++) {
      sliderImages[i].style.display = "none";
  };
  function grabImages() {
      var DOM_img;
      for (var i = 0; i &lt; sliderImages.length; i++) {
          imgSrc = sliderImages[i].getAttribute('src');
  
          DOM_img = document.createElement('img');
          DOM_img.src = imgSrc;
          imgList.push(DOM_img);
          console.log(imgList[i]);
      }; // end for
  
      prevImg.appendChild(imgList[imgList.length -1]);
      currentImg.appendChild(imgList[0]);
      nextImg.appendChild(imgList[1]);
  
  }; // end grabImages
  grabImages();
  
  var visibleImages = wrapperInner.querySelectorAll('ul li img');
  visibleImages.style = 'width: ' + settings.width;
  
  };// end slider
  slider();
  </code></pre>
  
  <p>Let me know if you need the css and html.  I'm just trying not to make the post too long.</p>