0

I have this code

var input = element.find('input').eq(0);

scope.focus = function() {
  if (!input.length) return;
  input[0].focus();
  input[0].select();
  var divWrapper = input.parent('.tags')[0];
  divWrapper.scrollLeft = divWrapper.scrollWidth;
  console.log(divWrapper.scrollWidth);
  console.log(divWrapper.scrollLeft);
};

This is inside a directive fnLink and focus is called when ui is changed this because use overflow: hidden and input disapear when many items on left... so I need to scroll to far right and keep input visible. The

divWrapper.scrollLeft = divWrapper.scrollWidth;

works fine on chrome dev tools but when focus is called don't update the scrollLeft attribute.

carlitux
  • 1,217
  • 10
  • 14

0 Answers0