javascript - jquery, performance-wise what is faster getElementById or jquery selector? -


प्रदर्शन के अनुसार क्या बेहतर है document.getElementById ('elementId') या $ ('# एलिमेंटआईडी') ? मैं अपने द्वारा गति की गणना कैसे कर सकता हूं?

यदि आप प्रदर्शन के बारे में चिंतित हैं, तो मूल getElementById बहुत अधिक है तेज़ी से, लेकिन jQuery बहुत सारी सामानों तक आपको बहुत आसान पहुंच देता है इसलिए, आप ऐसा कुछ करना चाह सकते हैं:

  $ (document.getElementById ("some_id")) .jQueryCall ();  

यह आपको बेहतर प्रदर्शन देगा, और साथ ही, आप jQuery का उपयोग करने की अनुमति देते हैं।


Comments

Popular posts from this blog

iphone - How do I make a UIPickerView in a UIActionSheet -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -