Append an input after a textarea with Javascript or jQuery?

You can use the aptly-named after() method.

You can use the aptly-named after() method: $("textareaname=messaggio"). Click(function() { $(this). After(""); }); If you want to avoid creating the check box if it already exists, you can do something like: $("textareaname=messaggio").

Click(function() { var $this = $(this); if (!$this. Next(":checkbox"). Length) { $this.

After(""); } }).

Presuming you only want the checkbox created on the first click to the textarea, you could do something like this: $("#messaggioajaxd textarea"). Click(function(){ if ($('#createdCheckbox'). Length==0){ $('').

Attr('type','checkbox'). Attr('id','createdCheckbox'). InsertAfter($(this)); } }); Example on jsfiddle.

Niklas beat me to it but here is what I was going to suggest... Demo: jsfiddle.net/wdm954/ppnzf/1/ $('textarea. Areamsgnoava'). Click(function() { if ($('input.

New'). Length == 0) { $(this). After(''); } }).

I think that some IE version will not like that you add a field dynamically. If you can add an element to the form, may be you could change the form totally, and inject it as a new form instead, using div. InnerHTML or using the DOM.

And add the checkbox in the original HTML as hidden, and show it if the textarea is clicked. Eg: My Wall Then if you have the reference of the textarea DOM node: textarea. Onfocus = function(ev){ var ta = ev.

Target || ev. SrcElement; ta.form.checkBox. RemoveAttribute('style'); } Or using jQuery and focus.

Not really an option, if the div element cannot be modified. – Niklas May 30 at 10:46 Misread the can/cannot... then I guess he'll have some trouble when submitting the form in IE. I've edited the answer accordingly – Mic May 30 at 10:52.

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.

Related Questions