Как удалить <литий> </литий> от ул.?

Потому что конструктор суперкласса не вызывается автоматически. Например, может быть несколько конструкторов, некоторые из которых принимают дополнительные параметры. Так что у вас не всегда есть «пустое» выражение super (), но что-то вроде этого:

public class DerivedClass extends SomeOtherClass
{
   private String anotherParameter;
   public DerivedClass(int parameterA, String parameterB, String anotherParameter)
   {
     super(parameterA, parameterB);
     this.anotherParameter = anotherParameter;
   }
}

Редактировать: Я, очевидно, забыл сказать (или мой выбор слов просто это было плохо, но я не являюсь носителем языка, извините за это) что если суперкласс не принимает никаких параметров, вызов super () будет сделан для вас java / компилятором. (Теперь, когда я перечитал свой ответ, я вижу, что это действительно звучит так, как будто вам всегда придется вызывать super ().)

6
задан Michael Petrotta 2 November 2009 в 06:46
поделиться

3 ответа

That depends on what you have and what you're adding. Assuming you end up added items so it looks like this:

<ul id="list">
  <li><a href="#" class="clear">clear</a></li>
  <li><a href="#" class="clear">clear</a></li>
  <li><a href="#" class="clear">clear</a></li>
</ul>

then use remove() to remove a single item:

$("#list a.clear").click(function() {
  $(this).parent().remove();
  return false;
});

but if you have:

<ul id="list">
  <li>one</li>
  <li>two</li>
  <li>three</li>
</ul>
<a href-"#" id="clear">Clear</a>

and you want to clear all of them then use empty():

$("#clear").click(function() {
  $("#list").empty();
  return false;
});
12
ответ дан 8 December 2019 в 14:44
поделиться
$('li').remove();

Will remove all the li elements... I suggest you give it an id attribute when you add it so that you know which one you'll want to remove, then select it specifically with:

$('#my_li').remove();
3
ответ дан 8 December 2019 в 14:44
поделиться

Put a unique value into the elements id attribute when you write it. You then have a known unique referrence point from which to target that element for later manipulation.

1
ответ дан 8 December 2019 в 14:44
поделиться
Другие вопросы по тегам:

Похожие вопросы: