AtotehZ AtotehZ - 4 months ago 45
Javascript Question

Greasemonkey - removing div class(absolute beginner)

I've been told that if I want tips to alterations of a specific link I should ask here. I've already viewed a few topics, but I couldn't make the suggestions there work for me.

I wish to remove:

<div class="validation_ticker">
and everything within it(all the code in the code box):

<div class="validation_ticker">
<div class="validation_ticker_align">
<div class="validation_ticker_icon"></div>
<div class="validation_ticker_msg" style="line-height:1.1em">
Is <a href="/account/editprofile">mymail@gmail.com</a> still your email address? Please <form action="/account/revalidate_email" method="post" id="revalidate_email" style="display: inline; margin: 0; padding: 0;"><button style="display: inline; border: 0; border-style: none; background: none repeat scroll 0 0 transparent; background-image: none; margin: 0; padding: 0; line-height: normal; list-style: none outside none; text-decoration: none; width: auto; height: auto; font-size: 13px; color: #ffff00" type="submit" value="click here">click here</button></form> to re-validate your account or <a href="/account/editprofile">change your address</a>.<br>
Not seeing email? Check your SPAM folder and mark as "NOT SPAM"!
<script type="text/javascript">

jQuery(function($) {
$('#revalidate_email').submit(function() {
$(this).ajaxSubmit(true);
return false;
});
});


It is a verification banner at the top of the screen. The site wants E-mail verification regularly, but I'm not too keen on that, I often mistake it for phishing too.

EDIT2: Code updated to working version

This is what I've come up with from the advise I was given by Ashkan:

// ==UserScript==
// @name Script Name
// @namespace namespace
// @include http://www.X.com/
// @version 1
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// ==/UserScript==
$('.validation_ticker').remove();


Thanks to everyone who answered.

Answer

Make sure that jQuery is added to your script at the top of the script:

// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js

Use the jQuery remove function:

$('.validation_ticker').remove();
Comments