Skip to content

Instantly share code, notes, and snippets.

@rabel001
Last active April 21, 2018 23:11
Show Gist options
  • Save rabel001/eaddf750f281776003409d06116a501f to your computer and use it in GitHub Desktop.
Save rabel001/eaddf750f281776003409d06116a501f to your computer and use it in GitHub Desktop.
Adding buttons
var csstext = '.btn-new { margin: auto; } #_div { display: flex; }';
var style = document.createElement('style');
var cssTextNode = document.createTextNode(csstext);
style.type = 'text/css';
style.appendChild(cssTextNode);
style.id = "css-new";
document.head.appendChild(style);
var pagination = document.getElementById('pagination');
var div = document.createElement('div');
div.id = "_div";
var a = document.createElement('a');
a.innerText = 2;
a.target = "_blank";
var url = document.getElementById('search_url').value + "&pageno="
a.href = url + 2;
a.classList.add('btn');
a.classList.add('btn-default');
a.classList.add('btn-new');
div.appendChild(a);
for (var i = 3; i < 11; i++)
{
var b = a.cloneNode();
b.innerText = i;
console.log(url + i);
b.href = url +i;
b.target = "_blank";
div.appendChild(b);
}
pagination.appendChild(div);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment