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'));     }); }); 

http://jsfiddle.net/xert8/2/

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);             } } 

http://jsfiddle.net/53qqu/6/

hope helps.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -