elements

Iterating through all the <div> tags on a page

I want to go through all the elements on a page using Javascript and see if they have a property set. Is there an easy way to do this, or do I have to use a recursive solution? ...

Trying to replace html tags using regex

For the example, I'm trying to replace <script type='text/javascript'>some stuff</script> with: <div type='text/javascript'>some stuff</div> I'm currently testing with: alert( o.replace( /(?:<\s*\/?\s*)(script)(?:\s*([^>]*)?\s*>)/gi ,'div') ); But what I'm getting is: divsomestuffdiv How can I get this to only replace the "sc...

Is it possible to clone html element objects in JavaScript / JQuery?

Hi, i am looking for some tipps how to solve my problem. I habe a html element (like select box input field) in a table. Now i want to copy the object and generate a new one out of the copy, and that with JavaScript or jQuery. I think this should work somehow but i´m a little bit clueless at the moment. Something like this (pseudo co...

jQuery/Javascript - How to fire an event when a button's value is changed?

I am working on a plugin for jQuery that will essentially style certain elements. Like jqTransform I could just replace the element but I chose to position the real element off screen and make a new element thats styled. This allows triggering the actual events of the real element. Also, if an onclick handler or onchange handler for a te...

Most Important Elements inside a RSS/Atom feed

Hello, We're building an "on-demand" feed parsing service (http://superfeedr.com) that developers can plug directly into their own applications. Instead of building your own feed parsing module, and spending days in setting it up and maintaining it, we do the "hard" work for you and our service sends you updates in real-time and standar...

Can I get html elements with nokogiri?

Hi, I have a doubt about nokogiri, I need to get the HTML elements from a page, and get the xpath for each one. The problem is that I can't realize how to do it with nokogiri. The HTML code is random, because I've to parse several pages, from different websites. ...

jQuery toggle next two elements

I have a form select element that, when a certain value is selected, will toggle two other elements on the page (a dt / dd pair). The event is triggered correctly, but I can't get the elements to toggle - note I am using class selectors because the number of these element "sets" on the page is variable. Here is my code: $(".lender_id"...

How can I return the last element in a dictionary in C#?

My dictionary: Dictionary<double, string> dic = new Dictionary<double, string>(); How can I return the last element in my dictionary? ...

Jquery: run a method on certain elements but not others

I'm having a hard time figuring out how to run a method on certain elements/nodetypes but not others. For instance here's some HTML: <div id="parent"> <div class="subparent">Changing Text <div class="no-change">Changing Text</div> </div> <div class="subparent">Changing Text</div> <div class="child">Changing ...

jQuery: Creating a New DOM element and showing it

So as the title suggests I wish to create a new dom element (the HTML is generated and retrieved via AJAX). I kind of got it working but it appears hidden, and when I try to Fade In it breaks! function AddContent(Content) { div = document.createElement(Content) div.appendTo($("#contentAreas")); // $(div).f...

Should I use Elements or Attributes in XML?

Hello I am learning XML from W3schools. Here: hXXp://www.w3schools.com/xml/xml_attributes.asp The author mentions the following: XML Elements vs. Attributes <person sex="female"> <firstname>Anna</firstname> <lastname>Smith</lastname> </person> <person> <sex>female</sex> <firstname>Anna</firstname> <lastname>Smith<...

jQuery select elements on 1st "level"

I want to select only the elements on the first "level". Ex: <div id="BaseElement"> <p>My paragraph 0</p> <div> <span>My Span 0</span> <span>My Span 1</span> </div> <span>MySpan 2</span> <span>MySpan 3</span> <p>My paragraph 1</p> </div> Let's say that you got the BaseElement node. var Element = $("div#BaseElemen...

CSS3 Property opacity

How can i only impact the opacity of a parent element and not its children eg, i want signup_backdrop opacity to be set at 0.5 but it's child element signup_box i don't want to have any opacity at all but it will apply the opacity set in signup_backdrop as inherited. ...

BizTalk mapping, nested collections of elements, help needed

Hi I have a schema that contains the details for an order. Within the schema, I have a collection of line items containing details of each item within the order. Schema is similar to the following structure. Order SaleItems SaleItem OrderID Price Quantity etc. I have a requ...

Running a function on multiple elements using Jquery

Hey, I've got some code that I'd like to run on every single checkbox on my page within a table, but I'm not sure of the best way to do this? I've tried something like this but it didn't work :( $(document).ready(function() { function whatever (elem) { var $elem = elem; $elem.val('test'); } $('table tr td :check...

Only one web part added to the wp gallery when multiple webpart files specified in module

I'm trying to deploy multiple web parts as part of the same feature. SharePoint itself seems to do this quite happily by specifying multiple File elements in a single Module element (see C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\SearchWebParts); in my case, only the first web part is added ...

count from several multidimensional arrays

hi all, i have foreach, which generate following arrays: ==== array 1 ==== array 0 => array 'tag' => string 'daf' (length=3) 1 => array 'tag' => string 'daa' (length=3) 2 => array 'tag' => string 'daf' (length=3) 3 => array 'tag' => string 'daaa' (length=4) 4 => array 'ta...

Use CSS to create multiple elements that take up the entire width of the parent.

I'm trying to achieve a horizontal CSS menu bar where all of the <a> elements combined expand to the entire width of the parent. The HTML looks something like this: <div id="parent"> <a href="/">Home</a> <a href="/learn">Learn More About The Product</a> <a href="/about">About Us</a> <a href="/contact">Contact Us</a> </d...

what are the fast algorithms to find duplicate elements in a collection and group them?

Say you have a collection of elements, how can you pick out those with duplicates and put them into each group with least amount of comparison? preferably in C++, but algorithm is more important than the language. For Example given {E1,E2,E3,E4,E4,E2,E6,E4,E3}, I wish to extract out {E2,E2}, {E3,E3}, {E4,E4,E4}. what data structure and...

Cannot get CSS Elements centered

Hi there, I cannot get my site to be centered for the life of me with CSS. I have tried all the usual methods suggested around the web including: body { text-align: center; } #container { width: 770px; margin: 0 auto; text-align: left; } Then using <div id="container> <!-- Centered Content Goes here--> </div> But ...