0

I have a div with the following css

CSS

#divToUpdate {
    width: 300px;
    height: 300px;
    overflow: hidden;
}

and I am sending it new html content from jquery.

JS (jquery)

$("#divToUpdate").append(newInfo);

But i want the 'focus' of the div to be on the new content, not on the historically first content.

EnglishAdam
  • 1,380
  • 1
  • 19
  • 42
  • 1
    you mean you want to use [`.prepend()`](http://api.jquery.com/prepend/) and add the content on top of the existing? – Nico O Sep 02 '14 at 15:48
  • No, because the html should be read 'storylike' at a later point (top to bottom) – EnglishAdam Sep 02 '14 at 15:52
  • @Nico, but thanks because I had forgotten about prepend and maybe it could be used if all else fails, THANKS! – EnglishAdam Sep 02 '14 at 15:53
  • Then you should have a look at [`scrollTop()`](http://api.jquery.com/scrollTop/), also see [this question](http://stackoverflow.com/questions/10503606/scroll-to-bottom-of-div-on-page-load-jquery). You can add content to your container and scroll to the end of it to "hide" the previous content. – Nico O Sep 02 '14 at 15:55
  • OK, off to have a look, thx again. Surprised that i'll have to use js though! – EnglishAdam Sep 02 '14 at 15:58
  • The solutions there are not suitable for me given the amount of html content in relation to html div size. – EnglishAdam Sep 02 '14 at 16:15

1 Answers1

0

try : $(this).focus()

maybe it helps

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
orbatschow
  • 1,497
  • 2
  • 13
  • 26