search submitbutton in all forms with textareas with jquery

Posted by domueni on Stack Overflow See other posts from Stack Overflow or by domueni
Published on 2010-05-18T13:21:06Z Indexed on 2010/05/18 13:31 UTC
Read the original article Hit count: 217

Filed under:
|
|
|

Hi there

i'm working on a ff-plugin which searchs a webpage for all textareas and places a warning before the submit button.

my code looks like this

var submitWarning = content.document.createElement("div");
submitWarning.innerHTML = "Fancy Message";
$('textarea', window.content.document).each(function() {
    var form = $(this, window.content.document).parents('form:first');
    $(form, window.content.document).children('input[type=submit]').each(function() {
         form.insertBefore(submitWarning, this);
    });
});

if i search all submits with $('input[type=submit]'.each... it works fine but since i added the thing with the textarea and the form:first i got problems (nothing happens)

p.s. i use the window.content.document thingy because its a ff-plugin and it won't work nothing without it

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html