• Penguin-Pal

    Self-destructive code

    November 27, 2013 by Penguin-Pal

    Hi there,

    If you're looking for a way of creating a script that not only uses conditions to decide whether or not to apply it but are also looking for a method of completely removing it from a certain script page, maybe you'd find this useful.

    Basically the syntax of this code isn't too long. It's made of:

    • A function to begine with, to make it work.
    • Wrapping "tags" to be used as some sort of anchors, to determine what part of the code to remove.
    • A certain code to do, placed between the wrapping tags.
    • A condition, also trapped between the "anchors". If it's true then trigger the self-destruction code.

    When and if the condition is true, it then would use $.getJSON to get the content of the JS page on which the code is found, remove the requested "a…

    Read more >