How to put a button inside of a text entry field in a form on a website using javascript, css, html -
i write greasemonkey script make button inside of text entry form on websites, text entry forms this:
____________________ username:|___________|button| ____________________ password:|___________|button|
is there way can javascript, html, , css? note want greasemonkey script work on website's who's layout not know, can't use image repositioning trick in post: how add "search" button in text input field?
okay, let's start jquery, since it's more concise.
$('form').each(function () { $(this).find('input').filter(':text').each(function () { $(this).after($('<button>').text('my button')); }); });
edited non-jquery version.
okay, here go!
var forms = document.getelementsbytagname('form'); (var = 0; < forms.length; i++) { var form = forms[i]; var inputs = form.queryselectorall("input[type=text]"); (var j = 0; j < inputs.length; j++) { var input = inputs[j]; var button = document.createelement('button'); button.innertext = 'my button'; input.parentnode.insertbefore(button, input.nextsibling); } }
hope helps.
Comments
Post a Comment