[LON-CAPA-cvs] cvs: rat /client parameter.html

raeburn raeburn at source.lon-capa.org
Wed Jun 25 16:19:12 EDT 2025


raeburn		Wed Jun 25 20:19:12 2025 EDT

  Modified files:              
    /rat/client	parameter.html 
  Log:
  - Remove link will now remove adjacent div regardless of whether other links
    have been used previously.
  
  
Index: rat/client/parameter.html
diff -u rat/client/parameter.html:1.92 rat/client/parameter.html:1.93
--- rat/client/parameter.html:1.92	Fri Dec 29 21:06:03 2023
+++ rat/client/parameter.html	Wed Jun 25 20:19:12 2025
@@ -5,7 +5,7 @@
 The LearningOnline Network with CAPA
 Parameter Input Window
 //
-// $Id: parameter.html,v 1.92 2023/12/29 21:06:03 raeburn Exp $
+// $Id: parameter.html,v 1.93 2025/06/25 20:19:12 raeburn Exp $
 //
 // Copyright Michigan State University Board of Trustees
 //
@@ -642,26 +642,21 @@
     var frame = window.frames["choices"];
     if (frame.document.getElementById('LC_string_ipacc_inner_'+iptype)) {
         var innerDiv = frame.document.getElementById('LC_string_ipacc_inner_'+iptype);
-        var count = innerDiv.childNodes.length 
         var ipDiv = frame.document.createElement('div');
         ipDiv.innerHTML = '<input type="text" size="10" name="setip'+iptype+'" onblur="parent.ipstringeval();" />'+
-                          '<a href="#" onclick="parent.removeIpRule(\''+iptype+'\',\''+count+'\')">Remove</a>';
+                          '<a href="#" onclick="parent.removeIpRule(this,\''+iptype+'\')">Remove</a>';
         frame.document.getElementById('LC_string_ipacc_inner_'+iptype).appendChild(ipDiv);
     }
     return false;
 }
 
-function removeIpRule(iptype,num) {
+function removeIpRule(caller,iptype) {
     var frame = window.frames["choices"];
     if (frame.document.getElementById('LC_string_ipacc_inner_'+iptype)) {
         var innerDiv = frame.document.getElementById('LC_string_ipacc_inner_'+iptype);
-        for (var i=0; i<innerDiv.childNodes.length; i++) {
-            if (i==num) {
-                innerDiv.removeChild(innerDiv.childNodes[i]);
-                ipstringeval();
-                break;
-            }
-        }
+        var divToRemove = caller.closest('div');
+        innerDiv.removeChild(divToRemove);
+        ipstringeval();
     }
 }
 




More information about the LON-CAPA-cvs mailing list