0

I specified like this

<div id="Chart1"/>
<div id= "Chart2"/>

and on getting the offset top value ($("#Chart2").offset().top) of second div it doesn't consider the pervious div element

Sample link: http://jsplayground.syncfusion.com/zcmkbrle

And if I specify like this

<div id="Chart1"></div>
<div id= "Chart2"></div>

and on getting the offset top value of second div it consider the previous one.

Sample link: http://jsplayground.syncfusion.com/0fzplhdm

I am using jQuery version 2.1.4.

So suggest an idea to rectify this. I need to get the exact offset value of the div.

Jaya
  • 27
  • 1
  • 10

2 Answers2

0

<div /> is not valid HTML. see this SO answer for further details..

And in your case, the second example shows the exact offset. For confirmation, use Web Development Tool.

Community
  • 1
  • 1
vinrav
  • 371
  • 3
  • 12
0

<div/> is not valid HTML so can you please use </div instead of />.

I have modified the sample. You can find it here:

http://jsplayground.syncfusion.com/mjzicdbf

Nisse Engström
  • 4,738
  • 23
  • 27
  • 42
Akbar Basha
  • 1,168
  • 1
  • 16
  • 38