Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,025

HOME > jQuery > jQuery Utilities > jQuery.each() - Utilities , jQuery



Clound SSD Virtual Server

jQuery.each() - Utilities , jQuery

jQuery.each() เป็นการใช้ jQuery Utilities กับ jQuery.each() ฟังก์ชั่นทั่วไปที่สามารถใช้ในการต่อเนื่องย้ำกว่าวัตถุทั้งสองและอาร์เรย์ อาร์เรย์และอาร์เรย์เช่นวัตถุที่มีคุณสมบัติความยาว (เช่นวัตถุอาร์กิวเมนต์ของฟังก์ชันของ) เป็นซ้ำโดยดัชนีตัวเลขจาก 0 ถึงความยาว 1 วัตถุอื่น ๆ ที่มีซ้ำผ่านคุณสมบัติที่กำหนด

Syntax
jQuery.each( collection, callback(indexInArray, valueOfElement) )


Example ตัวอย่างการใช้งาน jQuery jQuery.each()

jQueryeach.html


<html>
<head>
<title>ThaiCreate.Com jQuery Tutorials</title>
<style>
  div { color:blue; }
  div#five { color:red; }
</style>
<script type="text/javascript" src="jquery-1.6.4.js"></script>
<script type="text/javascript">
		$(document).ready(function(){
				
				var arr = [ "one", "two", "three", "four", "five" ];
				var obj = { one:1, two:2, three:3, four:4, five:5 };

				jQuery.each(arr, function() {
				  $("#" + this).text("Mine is " + this + ".");
				   return (this != "three"); // will stop running after "three"
			   });

				jQuery.each(obj, function(i, val) {
				  $("#" + i).append(document.createTextNode(" - " + val));
				});
		
		});
</script>
</head>
<body>

  <div id="one"></div>
  <div id="two"></div>
  <div id="three"></div>
  <div id="four"></div>
  <div id="five"></div>

</body>
</html>



Screenshot

jQuery jQuery.each()

คำอธิบาย (ภาษาไทย)
จากตัวอย่างเป็นการใช้ jQuery Utilities กับ jQuery.each() ในการจัดการกับ element ที่อ้างถึง และการใช้งาน loop each ต่าง ๆ








ลิ้งค์ที่ควรศึกษา
Go to : jQuery Selectors : jQuery Selectors and Element


เกี่ยวกับบทความ
ส่วนหนึ่งของบทความได้เรียบเรียงและแปลจากเว็บไซต์ jQuery.Com โค้ดตัวอย่างคำสั่งนี้อยู่ภายใต้สัญญาอนุญาตของ GFDL สามารถนำโค้ดและคำสั่งใช้งานได้ฟรี สงวนลิขสิทธิ์เฉพาะคำอธิบายภาษาไทย


   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2011-09-22 21:57:35 / 2017-03-19 14:12:53
  Download : No files
 Sponsored Links / Related

 
jQuery.boxModel - Utilities , jQuery
Rating :

 
jQuery.browser - Utilities , jQuery
Rating :

 
.clearQueue() - Utilities , jQuery
Rating :

 
jQuery.contains() - Utilities , jQuery
Rating :

 
jQuery.data() - Utilities , jQuery
Rating :

 
.dequeue() - Utilities , jQuery
Rating :

 
jQuery.dequeue() - Utilities , jQuery
Rating :

 
jQuery.extend() - Utilities , jQuery
Rating :

 
jQuery.globalEval() - Utilities , jQuery
Rating :

 
jQuery.grep() - Utilities , jQuery
Rating :

 
jQuery.inArray() - Utilities , jQuery
Rating :

 
jQuery.isArray() - Utilities , jQuery
Rating :

 
jQuery.isEmptyObject() - Utilities , jQuery
Rating :

 
jQuery.isFunction() - Utilities , jQuery
Rating :

 
jQuery.isPlainObject() - Utilities , jQuery
Rating :

 
jQuery.isWindow() - Utilities , jQuery
Rating :

 
jQuery.isXMLDoc() - Utilities , jQuery
Rating :

 
jQuery.makeArray() - Utilities , jQuery
Rating :

 
jQuery.map() - Utilities , jQuery
Rating :

 
jQuery.merge() - Utilities , jQuery
Rating :

 
jQuery.noop() - Utilities , jQuery
Rating :

 
jQuery.now() - Utilities , jQuery
Rating :

 
jQuery.parseJSON - Utilities , jQuery
Rating :

 
jQuery.parseXML() - Utilities , jQuery
Rating :

 
jQuery.proxy() - Utilities , jQuery
Rating :

 
.queue() - Utilities , jQuery
Rating :

 
jQuery.queue() - Utilities , jQuery
Rating :

 
jQuery.removeData() - Utilities , jQuery
Rating :

 
jQuery.support - Utilities , jQuery
Rating :

 
jQuery.trim() - Utilities , jQuery
Rating :

 
jQuery.type() - Utilities , jQuery
Rating :

 
jQuery.unique() - Utilities , jQuery
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่