40 users online (0 members and 40 guests)  


  Results 1 to 2 of 2

Related

  1. Replies: 11
  2. What is difference between Seo and PPC    Forum: Search Engine Optimization - SEO - Forum
    Replies: 10
  3. Replies: 8
  1. #1
    mayur_sk's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2010
    Posts
    1

    javascript difference

    what is the difference between document.getElementById('someelem') and $('someelem'). both does the same thing ? is so which one is better to use.thanks.

  2. #2
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: javascript difference

    Hi there mayur_sk,

    and a warm welcome to these forums.

    Obviously, $('someelem') will only work with a javascript library such as Jquery or MooTools.

    If you are writing your own code you will need to use document.getElementById().

    Obviously, you can use a variable for it, ie...
    var el=document.getElementById('foo');