الفرق بين المراجعتين ل"jQuery/event/result"

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
 
سطر 19: سطر 19:
 
<head>
 
<head>
 
   <meta charset="utf-8">
 
   <meta charset="utf-8">
   <title>event.result demo</title>
+
   <title>event.result مثال على الخاصية</title>
 
   <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
 
   <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
 
</head>
 
</head>
 
<body>
 
<body>
 
   
 
   
<button>display event.result</button>
+
<button>عرض event.result</button>
 
<p></p>
 
<p></p>
 
   
 
   
 
<script>
 
<script>
 
$( "button" ).click(function( event ) {
 
$( "button" ).click(function( event ) {
   return "hey";
+
   return "مرحبًا";
 
});
 
});
 
$( "button" ).click(function( event ) {
 
$( "button" ).click(function( event ) {

المراجعة الحالية بتاريخ 11:39، 6 يونيو 2018

event.result

القيمة المعادة

تُعيد كائنًا من النوع Object.

الوصف

تعيد هذه الخاصية القيمة الأخيرة المُعادة بواسطة معالج الأحداث الذي أطلقه هذا الحدث، ما لم تكن هذه القيمة غير معرفة undefined.

event.result

أُضيف مع الإصدار: 1.3.

يمكن أن تكون هذه الخاصية مفيدة للحصول على القيم المُعادة السابقة للأحداث المخصصة.

أمثلة

عرض قيمة معالج الحدث المُعادة السابقة:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>event.result مثال على الخاصية</title>
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
 
<button>عرض event.result</button>
<p></p>
 
<script>
$( "button" ).click(function( event ) {
  return "مرحبًا";
});
$( "button" ).click(function( event ) {
  $( "p" ).html( event.result );
});
</script>
 
</body>
</html>

مصادر