Wikipedia:User scripts/Guide: Difference between revisions

Content deleted Content added
Adding elements: Killing off this section, this is a really bad method as portlets are much more complex than just a div. Just use the functions, please
Removing elements: Updated to use jQuery
Line 295:
=== Removing elements ===
 
To move an element simply attach it in another place with [http://api.jquery.com/append/ <ttcode>appendChild.append()</ttcode>] or [http://api.jquery.com/prepend/ <ttcode>insertBefore.prepend()</ttcode>.]
 
To hide an element you can setsimply itsuse <code>style[http://api.display<jquery.com/hide/code> to <code>none.hide()</code>:]
 
<source lang="javascript">
// Example: remove copyright warning from edit page
var el = document.getElementById$( '#editpage-copywarn' ).hide();
 
if (el) el.style.display = 'none';
// Or modify the CSS directly
$( '#editpage-copywarn' ).css( 'display', 'none' );
</source>
 
This is easier with [[Special:Mypage/skin.css|your vector.css]] though:

<codesource stylelang="white-space:nowrapcss">
#editpage-copywarn {
display:none;
}
</codesource>
 
== Edit page ==