$('.direction') returns a jQuery object that is similar to an array of nodes. $('.direction')[0] returns the first node in the jQuery object, without any jQuery features... just the basic DOM node. $ ('.direction').eq(0).html or $('.direction:eq(0)').html are what you are looking for. They return the jQuery object instead of the basic DOM node. You're also better off using single quotes around the html string so you do not need to escape the quotes, but that is just a style issue
$(".direction").eq(1).html('<div class="direction_err">The Map cannot be loaded.</div>'); On Nov 25, 3:25 pm, shaf <shaolinfin...@gmail.com> wrote: > Hi Guys > I have several div classes and I am trying to insert some html into > one of them but firebug keeps telling me its not a function. Code > below: > > <div class="direction"></div> > <div class="direction"></div> > <div class="direction"></div> > <div class="direction"></div> > > $(".direction")[1].html("<div class=\"direction_err\">The Map cannot > be loaded.</div>"); > > ERROR MSG: > $(".directions_box")[id].html is not a function