You need to change it a bit, like this: var submitWarning = content.document. CreateElement("div"); submitWarning. InnerHTML = "Fancy Message"; $('textarea', window.content.
Document) . Closest('form') . Find('inputtype=submit') .
Before(submitWarning) The argument syntax is $(selector, context) when finding the form, first there's closest() which makes this easier, also when you have an element, you can just use $(this) inside it's each() no need to search for it again. Also, you can use before() to make it easier :).
You need to change it a bit, like this: var submitWarning = content.document. CreateElement("div"); submitWarning. InnerHTML = "Fancy Message"; $('textarea', window.content.
Document) . Closest('form') . Find('inputtype=submit') .
Before(submitWarning); The argument syntax is $(selector, context), when finding the form, first there's .closest() which makes this easier, also when you have an element, you can just use $(this) inside it's .each(), no need to search for it again. Also, you can use .before() to make it easier :).
And it works... thank you (didn't know the closest function – domueni May 18 '10 at 13:42.
The :has() selector is the best choice for me. Get rid of your extensive code and use this instead. Var buttons = $("form:has(textarea) inputtype=submit", window.content.
Document); $(""). Html("Fancy Message"). InsertBefore(buttons).
Elegant. ;) – Lance May May 18 '10 at 13:36 Elegant, but expensive :) Also I'm not sure the document fragment creation style works inside of a FF plugin, If you need window.content. Document, I would think document.
CreateDocumentFragment() would need to be aliased as well, it isn't inside jQuery: github. Com/jquery/jquery/blob/master/src/manipulation. Js#L415 – Nick Craver?
May 18 '10 at 13:41 Why expensive? If you're about to answer 'because of the :has selector, do you actually know how it works? :) – Seb May 18 '10 at 13:47 Yes I know how it works, keep in mind you're doing a tree search twice, instead of a getElementsByTagName, parent climb then tree search, which is faster.
:has(selector) is just a wrapper for! $(selector, context). Length – Nick Craver?
May 18 '10 at 14:29.
Try var form = $(this, window.content. Document). Closest('form');.
Not sure if that's the ticket, but it's the first thing off my head.
I have a form loading inside my page and there is a button out side this form its function is to submit this form. I want a way to write a submit complete function, means to know that the form successfully/completely submitted. I tried the jquery form plugin, but didn't work, I think because the submit come from a button outside the form.
Anyone knows any different ways?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.