jQuery low hanging newbie fruit for you to snack on

2012-06-18  Source: Original Site  Category:jQuery  Views:0 

Advertisement

I've rewritten my site scripts with jquery and eliminated a bulky menu
script, 2 different image viewers, ajax/rpc script I did years ago,
and a bunch of other bits, now all packed down into about 26kb total
including jquery and with more functionality :-)
Some random newbie questions you hopefully can help with:
Is there a way to specify multiple conditions in one $ call or I must
do $("img.class").add("a.class"). Anything like $("img.class|
a.class")?
How much overhead is there in a $ object call on a single element? I
find myself avoiding jquery-wizz and using regular syntax unless I
really want to chain some things together, or need selectors.
Is a $ object cached, and calling it a few times in a function is
nothing? I would assume it checks if defined and if so there you go,
so same as using any regular variable?
var x = $(this.parentNode): is a pointer to a $ object a better way
when calling a few times, or a bad idea for memory leaks or anything?
Seem to recall leaks there.
Does the above x used as x.parent() et al entail as much overhead as a
whole new $ call to the parent ID itself, more, less? I'll have a
block where I need to get at several elements within it to change a
photo, description, etc.
Do the jquery traverse functions ignore white space and such that give
different results in moz/ie? If not, why not?
There is only 1 parent node so why does the api for parent() say "Get
a set of elements containing the unique parents of the matched set of
elements." And have an option to filter the parent set returned.
Does the ajax timeout call the error function? Api doesn't say. If
not, why not and how to call a function from a timeout?
Is it possible to put an element reference into an ajax call that is
then used/returned in a success/error function? I've had to set a
variable above the ajax function ( x=$(this); ) that gets used in the
success/errors because "this" is no longer "that" within them :-)
It appears ajax does not account for caching by attaching a time
variable to url's as an option for GETs. Why not? Or did I miss it?
preventDefault and stopPropagation work xbrowser in jquery, correct?
They don't get much mention in the api except under one item, and I
always see plugins using "return false" instead.
How would you recommend doing doc ready calls that are only needed on
some pages of the site? It's such a waste if not needed. I'm worried
if I stick the call on the indiv. pages perhaps the jquery js file has
not loaded before it gets there - or does ext js have to be loaded and
parsed as arrived at? I think maybe that's only inline js, no? Maybe a
2nd external file on the specific page to call it? Or perhaps plugins
in the jquery file, called from the specific page, are the best way to
go?
For now I've wrapped the onready calls in an if createElement but that
doesn't help for specific bugs. Are there plans to detail exactly what
calls are failing in jquery in different browsers because I can't see
what might trigger a problem in a particular browser, what needs to be
avoided, protected, etc. This really is lacking and needs to be
documented clearly. Plans? I'm aware of http://docs.jquery.com/Known_Issues
but only one point is noted there!
Thanks. Hope some of you jquery pros enjoy the low hanging fruit
above :-)

Related articles
  • jQuery low hanging newbie fruit for you to snack on 2012-06-18

    I've rewritten my site scripts with jquery and eliminated a bulky menu script, 2 different image viewers, ajax/rpc script I did years ago, and a bunch of other bits, now all packed down into about 26kb total including jquery and with more functionali

  • Newbie question for you Oracle gurus. 2012-08-13

    Here's my scenario. I just build an 11g database (dev) by installing the oracle software only, running , my script files to create the tables and structures and full import of data from prod3. All seems to working fine. I just build another host exac

  • Hacking is a Low-Hanging Fruit Exercise 2012-11-20

    Responses (from another site) on my recent, "Security Alert: They Should Have Used Linux" led me to explore the conclusion that hacking is really only for those seeking the low-hanging security fruit as their prey. These folks, who tout themselves as

  • The truth about software low-hanging-fruit vulnerability 2015-04-09

    If you were to just take weekly media reports and monthly security researcher statistics as your metric, then I suspect it would be a safe bet to suggest that you would say software security vulnerabilities are on a steep upwards curve. Furthermore,

  • jQuery can you simplify this selector? easy for you... 2013-04-08

    Gurus have the following selector and wonder how this could be simplified? :confused: $('#PG1_L03-table td:nth-child(3) input, #PG1_L03-table td:nth-child(5) input, #PG1_L03-table td:nth-child(7) input, #PG1_L03-table td:nth-child(9) input').bind....

  • Newbie Question- Do you need Antivirus/firewall/spare protection for Ubuntu? 2014-05-29

    Newbie Question- Do you need Anti-virus/firewall/spare protection for Ubuntu? If so where I can it? Also is there any free ware for Spy ware/firewall/Anti-virus?

  • jQuery Message "Your Google Toolbar can fill this in for you. Select AutoFill " on validating field on IE 7 with google toolbar 2012-03-05

    Thanks for the validation plugin. It work fine but in IE 7 with google toolbar it shows message "Your Google Toolbar can fill this in for you. Select AutoFill ". while validating fields. How can I get rid of it.

  • jQuery Many movies online for you. Come on,please. Here 2012-09-08

    Many movies online for you. Come on,please. Here http://englearn.zhan.cn.yahoo.com There are many, many Hollywood films and Disney cartoons online. If your Chinese is not good enough, please come in by the following links. To watch Hollywood films by

  • jQuery 1 new private message(s) for You. -- NOT 2013-04-28

    When I log in, I get the message "1 new private message(s) for You." but the private message is long gone, I deleted it. Is there a way to remove this?

  • jQuery UI dialog simple question for a newbie 2015-05-09

    all. A very simple jquery UI dialog question as I undertake learning this new tool: I have a button: <asp:Button id="btnCancelMeeting" Text="Cancel Event" runat="server" OnClientClick='javascript:return jsConfirmCancellation();' /> that calls t

  • jQuery CODE REVIEW: the fruits of today's labor - now withREALCODE! 2012-12-03

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v = "urn:schemas-microsoft-com:vml" xmlns:o = "urn:schemas-microsoft-com:office:office" xmlns:w = "urn:schemas-microsoft-com:o

  • jQuery CODE REVIEW: the fruits of today's labor-nowwithREALCODE! 2012-12-14

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v = "urn:schemas-microsoft-com:vml" xmlns:o = "urn:schemas-microsoft-com:office:office" xmlns:w = "urn:schemas-microsoft-com:o

  • Ubuntu Phone credit low? Africans go for "beeping" 2013-01-29

    http://news.yahoo.com/s/nm/20070926/tc_nm/africa_beeping_dc_1 Phone credit low? Africans go for "beeping" By Andrew Heavens Tue Sep 25, 8:40 PM ET KHARTOUM (Reuters) - If you are in Sudan it is a "missed call." In Ethiopia it is a "miskin" or a "piti

  • jQuery CODE REVIEW: the fruits of today's labor - now with REALCODE! 2013-05-30

    <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40" xmlns:ns0="urn:schemas-microsoft-com:office:smarttags"> <

  • jQuery CODE REVIEW: the fruits of today's labor - now with REAL CODE! 2013-12-25

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=us-ascii"> <META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD> <BOD

  • Do ATI or NVIDIA's official drivers work for you in Ubuntu 6.06(Dapper) 2012-01-29

    Do ATI or NVIDIA's official drivers work for you in Ubuntu 6.06(Dapper) Hey everybody. Utilizing the 3D acceleration on those fancy graphics cards people have seems to be one of the things that give people a lot of trouble, and therefore is also enve

  • Everyone needs JESUS! JESUS loves you! JESUS died for you! 2012-02-21

    JESUS & YOU CREATION In the beginning, thousands of years ago, God created the heavens and the earth. He made the sun, the moon and the stars. He made the waters and the dry land. He made all that is on earth. He made the grass, flowers and trees

  • Do ATI or NVIDIA's official drivers work for you in Ubuntu 6.10(Edgy) 2012-05-10

    Do ATI or NVIDIA's official drivers work for you in Ubuntu 6.10(Edgy) Hey everybody. Utilizing the 3D acceleration on those fancy graphics cards people have seems to be one of the things that give people a lot of trouble, and therefore is also envelo

  • How to be able to preload jquery contents into hidden tabs for ie browser 2012-07-31

    The problems im facing is when I use something like jcarousellite inside tabs. It works fine in browsers other than ie. In ie, the carousel loads fine in the active tab, but in the inactive ones it doesnt preload. Basically when you click on a previo

  • Another newbie asking for some help 2012-11-17

    yes, I've read the tutorials :) let me say the one you guys have here is much easier to understand than a few others I've read. Okay, I'm just starting out trying to learn php but I built a site for me and some friends in html and some flash and I wa