#1
  1. Santosh Vaza
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2010
    Location
    JHome
    Posts
    356
    Rep Power
    16

    Jquery Alternative.


    Hi guys.
    I liked jquery very much specially it helps you to select the elements by using css selectors.

    but in my projects i am using the jquery only for selecting the elements and only its couple methods(2 or 3) are worth to me.
    I think its useless to put a 16 KB file on your page if you are using only its .val() method for getting the value of HTML elements. Does any one knows any jquery plugin or any open souorce js which provides me the elements object when i invoke it using css selector , For example
    #('#txtTD')-> this will give me the object
    #('#txtTD').value -> will give me the value of object.

    i googled around but only found this.
    http://www.openjs.com/scripts/dom/css_selector/


    -Thanks.
    no one can become perfect by merely ceasing the act
  2. #2
  3. Code Monkey V. 0.9
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2005
    Location
    A Land Down Under
    Posts
    2,345
    Rep Power
    2063
    If you're really that worried about the size (16kb is not tiny, but it's really not that big either), why not take the jQuery code and remove the parts that you don't need and leave only the parts that you do? That will give you the functionality that you want, along with the smallest possible file size.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2006
    Location
    I'm sneaking up behind you.
    Posts
    1,490
    Rep Power
    835
    If you want to get the value of an input element with an id, why not use plain javascript? document.getElementById('txtTD').value ...
    Why do we always seek someone, something or some thought? Are we afraid of ourselves?
  6. #4
  7. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,116
    Rep Power
    4307
    Try using Sizzle JS. It's actually the sector engine that jQuery uses.

    Originally Posted by Catacaustic
    why not take the jQuery code and remove the parts that you don't need and leave only the parts that you do?
    Easier said than done.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  8. #5
  9. Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Sep 2007
    Location
    outside Washington DC
    Posts
    2,576
    Rep Power
    3703
    Setup your pages to download jQuery minimized from Google's content distribution system. For most of your users, it will be cached, as lots of software is built on jQuery, so you can just use the copy loaded for some other Web 2.0 site. Zero download for your application.

    It becomes a "once only" cost that may only have to happen a couple of times a year. That's trivial.

    Comments on this post

    • Kravvitz agrees
    • Winters agrees
  10. #6
  11. Cunning Linguist
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2003
    Location
    I used to live at home, now I stay at the house
    Posts
    10,166
    Rep Power
    2042
    Moved from the Lounge...
    Support requests via PM will be ignored!
    Read These: The General Rules Thread | The General FAQ Thread | NEW USERS - How to post a question


IMN logo majestic logo threadwatch logo seochat tools logo