To add the div#optionform
after div.row
without removing div.row
, you can use the insertAfter
method instead of after
. Here’s the corrected code:
javascript$('#addoption').on('click',function(){
$('
').load("externall.php #optionform", function() {
$(this).insertAfter('.row');
});
});
This code creates a new div
element, loads the content of externall.php #optionform
into it, and then inserts this new div
element after div.row
using the insertAfter
method.
المزيد من المعلومات
بالتأكيد! في الكود السابق، نستخدم الدالة load
لجلب محتوى div#optionform
من ملف external.php
، ثم نستخدم دالة insertAfter
لإدراج هذا المحتوى بعد div.row
في صفحة index.php
.
قد تحتاج إلى التأكد من أن عملية الحذف التي تراها لا تحدث من قبل أي كود آخر في صفحتك. قد تحتاج أيضًا إلى التحقق من أن عنصر div.row
و div#optionform
ليس لديهما أي تصميم CSS يؤدي إلى عدم ظهورهما بشكل صحيح.
إذا واجهت أي مشكلة، يمكنك مشاركة المزيد من الكود أو تفاصيل إضافية للمساعدة في تحديد سبب المشكلة.