elements

JQuery. Hide elements before they rendered. Best practice

Hello everybody, I want to generate html layout with areas (divs, spans) that can be shown/hidden conditionally. These areas are hidden by default. If I call .hide method with jquery on document.ready these areas may blink (browsers render partially loaded documents). So I apply "display: none" style in html layout. I wonder what is t...

Selecting multiple cached elements

In jQuery you can select two elements by id like: $('#elem, #elem2'); BUT What if you have cached the elem and elem2, and what to apply the same method/function to them both? i.e. $elem = $('#elem'); $elem2 = $('#elem2'); This obviously wont work: $($elem, $elem2) Thanks! ...

CakePHP update multiple elements in one div

The idea is that I've 3 ajax links and each link is coupled to one single element (a form). The element will be loaded in one div. Each time when you click on a different link, the element that is requested before must be removed and the new one must come in there. So it has to update the DIV. The problem is, that it request the element,...

Styling individual radio buttons in drupal form

I have this group of radio buttons in which each of individual button has of its own position set through style attribute. I would like to how can I archive the same by using drupal form api. I found how to style as whole but, not as individual control within group. Here's how my html code look like - <input type="radio" name="base_loc...

xquery function to convert tag elements to attributes

Hello, I need to write a function that takes a sequence of "tag" elements of the form: <tag type="markupType" value="topic"/> <tag type="concept" value="death"/> ... and turns them into attributes of the form data-markupType="topic" data-concept="death" So far I have the following function: declare function local:tagsToAttrs($ta...

[JS/jQuery] Using livequery: Can't find propagated element created via ajax.

Hey guys, I'm using jQuery 1.3.2 and Live Query plugin. The script needs to work in FF as well as IE6. Upgrading jQuery and using live instead isn't a possibility. Somehow this script won't be called by the dynamically created element. $('select').livequery('change',function(){ var select_id = $(this).attr("id"); ...

jquery iterating through newly created elements

Hi All, I am trying to add new rows in my table, and save them into DB. First, I use .append() to append rows on the table: $("#tablename").append("<tr id='newRow'><td>newly added row</td></tr>"); The appending function works fine. My page displays the correct result. However, I am unable to select them with $("#newRow").each(func...

How to remove the selected element during a clone() operation

Hi All, I have a select box that gets cloned. I want to remove the user's previous selection from each cloned select box. Here is the method that does the clone() : function addselect(s){ $('#product_categories > .category_block:last').after( $('#product_categories > .category_block:last').clone() ); set_add_delete_links(); retu...

Replace an element name while retaining the attributes with jquery

I'm trying to create a jquery setup where all instances of <i> are changed to <em>. It's easy enough to do with: $("i").each(function(){ $(this).replaceWith($('<em>' + this.innerHTML + '</em>')); }); But what I am having trouble figuring out is how to change all the <i> tags but retain each ones individual attributes. So if I have...

Userscript, identify when elements are added to the page (via events?)

Right now, I am working with a page that is automatically updated and I'm using setInterval to check for new elements. I'd like to do this with events but I don't know how to tell if an element has been added to the page via an event. Is this possible? ...

jQuery: Giving each matched element an unique ID

I am writing an 'inline translator' application to be used with a cloud computing platform to extend non-supported languages. The majority of this uses jQuery to find the text value, replace it with the translation, then append the element with a span tag that has an unique ID, to be used elsewhere within the application. The problem ar...

jQuery - get form elements by container id

Which is the easiest way to get all form elements which are contained by a wrapper element. <form name="myForm"> <input name="elementA" /> <div id="wrapper"> <input name="elementB" /> <textarea name="elementC" /> </div> </form> In the above HTML I would elementB and elementC but not elementA. I do not want to list all fo...

jquery - How to reference two div elements for a single function?

I Have a function that references a specific input text box. I would like to extend the function to be used by two specific input text boxes. Rather than duplicate the code for the other text box, can anyone advise on how to reference the other? Here it uses #Tags, but if i wanted it to reference #Tags2 also, how could I do that? $(...

How to reset elements to their original state, after a chain of manipulations?

After a bunch of animating, adding classes and setting css styles. is there an easy way to reset an element to be back in its original server delivered state? ...

Which features do html form elements miss

I just wondered and wanted to gather together in one place all missing features of our beloved html form elements. One example could be missing of horizontal scrollbar in a listbox. But I am sure there are a lot of features we would like to see in our form elements by default. One missing feature per answer please. Thank you. ...

Different positioning in Firefox, Internet Explorer and Safari?

Hello, I believe this question has been asked a lot of times, and I have managed to overcome this problem before whenever it occurred. Just now, I feel stuck with it and can't find a proper solution to make it work in all browsers: it does work properly only in Firefox, while in IE and Safari its elements are somehow apart from each oth...

jQuery after show() assumes that display:inline is :hidden. Why?

With jQuery 1.4.2, :hidden filter is not filtering out elements that were hidden, but i've made then visible by calling show(). Filter assumes it is still hidden. Is this bug or am i missing something? Consider the following code: $("td.ms-authoringcontrols > span[id*='_ParallelApprovers']:hidden:first").css("display") "none" $("td.ms-...

Element Content Versus Attribute for Simple XML Value

I know the elements versus attributes debate has come up many times here and elsewhere (e.g. here, here, here, here, and here) but I haven't seen much discussion of elements versus attributes for simple property values. So which of the following approaches do you think is better for storing a simple value? A: Value in Element Content: ...

JQUERY - how Two elements - IMG - DIV when hover over IMG show/hide the DIV - added with hover hide/show on img allready

Im very new to the wonder that is jquery. and i just figure out how to make my img buttons show/hide with a opacity difference (as such) <script type="text/javascript"> <![CDATA[ $(".ExcommKnap").mouseover(function () { $(this).stop().fadeTo('fast', 0.5, function(){}) }); $(".ExcommKnap").mouseout(function () { $(this).stop().fad...

HTML elements: How can I simulate pressing the 'tab' key.

I want to trigger the same effect than when pressing the tab key on an element that has the focus. Is there any way of doing this? I am trying to make the focus jump to the next element. Thanks! (jQuery is an option) ...