Remove elements from in memory element in js

I have a java script file that is used in several places. It has this code:

var newDiv = lastDiv.cloneNode(true);

lastDiv has some <input> elements that I do not want to clone. I've created these input elements with the attribute <input copy="dont"> so that I could remove them out using the following code:"input[copy=dont]").remove()

The prototype.js select() finds these elements. But remove() does not work, newDiv still has the input elements that I wanted filtered. Prototype documentation states that it will remove from the document, but newDiv is not in the document, it is only in memory.

This is solved now: select() was returning an array. If only prototype would have returned a meaningful error message. It was returning the list of matching elements. Thanks for your answers guys. Will use valid HTML5. This works now"input[copy=dont]")[0].remove()


i think it's just a type in your selector , try this:"input[copy='dont']").remove()

also , just s suggestion , use the attribute data-copy instead of copy ex.

<input data-copy="dont" type="text" />

this will keep your elements valid HTML5

Need Your Help

NSMutableDictionary and values

objective-c cocoa-touch nsdictionary nsnull

Ok. I've searched and searched to no avail and I keep beating my head over this.

Sharepoint 2010 Replacable Parameter not working

sharepoint sharepoint-2010

I have an aspx page in _layouts that is part of a package. It contains :

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.