Skip to content

Instantly share code, notes, and snippets.

@adjohu
Created July 24, 2012 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adjohu/3170299 to your computer and use it in GitHub Desktop.
Save adjohu/3170299 to your computer and use it in GitHub Desktop.
//var formContainer = $("#ctl00_ContentPlaceHolder1_ffnpPayBrasPag1_dvBPCC");
var findPrev = function (node, needle) {
var found = false;
do {
node = node.previousSibling;
var nv = node.nodeValue;
if (nv && nv.indexOf(needle) > -1) {
found = true;
}
} while (!found);
return node;
};
var addBrBefore = function (node) {
var new_br = document.createElement("br");
node.parentNode.insertBefore(new_br, node);
};
var form = document.getElementById("ctl00_ContentPlaceHolder1_ffnpPayBrasPag1_dvBPCC");
var h1 = form.childNodes[1];
var select = document.getElementById("ctl00_ContentPlaceHolder1_ffnpPayBrasPag1_ddParcelamento");
var label = findPrev(select, "Número de Parcelas");
addBrBefore(h1.nextSibling);
form.insertBefore(select, h1.nextSibling);
addBrBefore(h1.nextSibling);
form.insertBefore(label, h1.nextSibling);
addBrBefore(h1.nextSibling);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment