<ul class="tabs--primary nav nav-tabs">
<li class="active"><a href="/packages/50411" data-drupal-link-system-path="packages/50411" class="is-active">View<span class="visually-hidden">(active tab)</span></a></li>
<li><a href="/packages/50411/edit" data-drupal-link-system-path="packages/50411/edit">Edit</a></li>
<li><a href="/packages/50411/delete" data-drupal-link-system-path="packages/50411/delete">Delete</a></li>
<li><a href="/packages/50411/edit/enrollment_drop_mode" data-drupal-link-system-path="packages/50411/edit/enrollment_drop_mode">Edit as Drop</a></li>
<li><a href="/devel/packages/50411" data-drupal-link-system-path="devel/packages/50411">Devel</a></li>
</ul>
:contains()
选择器,该选择器选择包含指定文本的所有元素
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul class="tabs--primary nav nav-tabs">
<li class="active"><a href="/packages/50411" data-drupal-link-system-path="packages/50411" class="is-active">View<span class="visually-hidden">(active tab)</span></a></li>
<li><a href="/packages/50411/edit" data-drupal-link-system-path="packages/50411/edit">Edit</a></li>
<li><a href="/packages/50411/delete" data-drupal-link-system-path="packages/50411/delete">Delete</a></li>
<li><a href="/packages/50411/edit/enrollment_drop_mode" data-drupal-link-system-path="packages/50411/edit/enrollment_drop_mode">Edit as Drop</a></li>
<li><a href="/devel/packages/50411" data-drupal-link-system-path="devel/packages/50411">Devel</a></li>
</ul>
将纯JS bu用于li
。$( ".nav-tabs li:nth-child(4) a" ).html( "Edit" );