element

How do I get element's className inside loop of elements?

I am trying to create a function that given a divid, and a list of classes, will then do some text replacing inside them. Having learned of how Firefox Dom is handling text nodes differently, I read that I had to use javascript to loop through the elements, sibling to nextSibling. The last obstacle I had in my script, of which you see...

Reset Particular Input Element in a HTML Form

I have multiple input textboxes in my page. I want to reset particular text box to its onload state if certain conditions fails. I am considering using a Hidden element to store the onload state of the textbox. I would other suggestions or solutions to resolve this issue. ...

Change the content of a <style> element through JavaScript

The Problem I have the following code: <html> <head> <style id="ID_Style"> .myStyle { color : #FF0000 ; } </style> </head> <body> <p class="myStyle"> Hello World ! </p> </body> </html> And I want to modify the contents of <style> through JavaScript. The Expected Solution The first solution was to use the innerHTML ...

YouTube API, jQuery attr won't swap element attributes (I think) in IE, but works in FF

JavaScript (jQuery) function display_youtube(new_url) { $('#movie_url').removeAttr('value'); $('#embed_url').removeAttr('src'); $(document).ready(function() { $('#movie_url').attr('value', new_url); $('#embed_url').attr('src', new_url); $('#shade').css('display', 'block'); $('#youtube_player')...

How to find with javascript if element exists in DOM or it's virtual (has been just created by createElement)

Hello. I hope a topic is self describing. I'm new on your site, it helped me much times but this time i was surprised not to find an answer on internet. The question is quite simple. Say, i have an element created in code: var elem = docuemnt.createElement('div'); ... I wish sometime to check have i placed it into the DOM bef...

Jquery counting elements by class what is the best way to implement this?

Ok what i'm trying to do is to count all of the elements in the current page with the same class and then i'm going to use it to be added onto a name for a input form. Basically i'm allowing users to click on an and then by doing so add another one for more of the same type of items. But i can't think of a way to count all of these simp...

LINQ to XML query help needed

<Fields> <Field> <Company>My Company</Company> </Field> <Field> <Address2>Villa at beach</Address2> </Field> <Field> <Email2>[email protected]</Email2> </Field> <Field> <Mobile>333-888</Mobile> </Field> <Field> <ContactMethod>Facebook</ContactMethod> </Fiel...

Using non W3C valid attributes on HTML elements

Hi, What is your opinion about using non valid attributes on html elements for easier jQuery selectors etc ? Eg. <div name="myDiv"></div> According to Visual Studio the name attribute is not valid for a div element. ...

jqueryui sortable: How to get the ID of the li-element another li-element was sorted onto?

Hi Folks, guess i have this and guess that this list is a sortable one: <ul> <li id="a">Hey</li> <li id="b">Ho</li> <li id="c">Silver</li> <li id="d">!</li> </ul> Now im sorting the list. I move the third Silver on before the first "Hey" what makes the list looks like this: <ul> <li id="c">Silver</li> <li id="a">Hey<...

Can an element have both an id and a class?

pretty self-explanatory. ...

Drupal form with custom ID

Correct me if I'm wrong, after reading drupal fapi related articles, I got the impression that fapi generates 'id' attributes by itself. It allows developers to assign 'name' attribute only. If that's the case, is there a way I can set desire 'id' value for elements? Because, I want my elements to have meaningful 'id' so that html/jquery...

js - using replace method to replace html element

hi everyone! i have a question. I have a work this morning but i don't know how to do it. My work here (html): <div class="demo"> <p>this is demo text</p> </div> here is my JS : var tempdata = $(".demo").text(); var replacedata = tempdata.replace("text","<span>1234</span>"); Look everything ok. but result is : this is demo <spa...

WPF How to bind to a specific element in the Collection

Hi, I want to make a binding to a specific element in the Collection. But I cannot figure out how to write the Binding. This is the code: public class MySource { .. public string SomeProp; public ICollection<T> MyCollection; .. } this.DataContext = new MySource(); <TextBox Text={Binding SomeProp} /> <TextBox Text={Binding FIRST_...

Jquery: Exclude a contained element

Hello <div><img src="truc.png" /> Chouette</div> I'd like to mouseoverize the div but not the img $('div').mouseover(go_truc); How can I do that ? ...

Using argument (this) passed via element eventhandler

Hey guys, I want to use the argument I pass (this) in a JS function and treat it as an jQuery variable. Example: <script> function useMe(obj){ $(obj).val(); ... ... ... } </script> <select id="selectid" onChange="useMe(this)"> <option>......</option> </select> Is there a possibility to treat the passed argument as ...

[GWT] Change Element's node name?

Is it possible to change the element's node name in GWT? I mean something like this: HTML h = new HTML(); h.getElement().setNodeName("mydiv") while there is no setNodeName() method for Element. I'd like to acquire <mydiv>some contents</mydiv> instead of default tag <div>some contents</div> Thanks for any hints. ...

get an id of child element and store in a variable using jquery?

I'm basically trying to do exactly what the subject suggests, but I'm getting "undefined" in my alert, and I'm not entirely sure why. I am fairly new to jquery, so, I probably have the syntax wrong, but not sure where to go from here. I'll post both of my attempts, which both yield "undefined" in the alert... //In my first attempt, I...

Topichead not being generated

I have the following code: <map title="Authoring Guide"> <topicref href="topics/front-matter.xml"/> <topichead navtitle="My TopicHead"> <topicref href="topics/who-should-use.xml"/> </topichead> ... When the PDF is generated using oXygen editor with the PDF Legacy plugin, the topichead element is completely ignored,...

Silverlight/WPF: Retreiving the size of a UIElement once it has been rendered on screen

I have the following simple piece of code: var canvas = new Canvas(); foreach (var ztring in strings) { var textblock = new TextBlock(); textblock.Text = ztring; panel.Children.Add(textblock); textblock.Measure(infinite...

required element content

I'm trying to create xsd for an element like this: <ElementType attr1="a" attr2 ="b">mandatory_string</ElementType> and I want to make the mandatory_string required. What should I add to this xsd: <xs:complexType name="ElementType"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="attr1" type="StringLength...