JQuery :: Selector On Existing Collection Containing DIV Elements
Jun 3, 2010
Let's say $pages is a collection containing all div elements that have an id of page1 or page2. From this, I wish now to select now only the page div (i.e page1 or page2) that contains a descendant with a class of 'A'. Tried lots of things, just can't get the format right.
So i've got a form that adds an element onto the page. This is working. When I try to remove said elements, that works. But the same 'delete' button doesn't work on elements not generated by javascript.
Code JavaScript: function destroyQuickTask() { $.post($(this).attr("href"), null, null, "script");
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
[Code].....
what I need is set an image title with given index (1)withvalue of span with given index (1). I tried some laborations with gt(), index(), but there is no success.
I have an element generator using jquery, However, elements generated were not affected by the event (click) even though they match tag and class name.
I am learning jQuery now and have a big interest in this javascript framework. I am trying to bind an event to more than one element. I won't meet any problem if using selector. But now, I've created a function which I will pass the element. And I need within this function, to bind the code. This is my current code :
function updateDay(dayObj, monthObj, yearObj){ //I want to bind both monthObj and yearObj. yearObj.change(function(){ //do something }); monthObj.change(function(){yearObj.change()}); } $(document).ready(function(){ updateDay( $("#day"), $("#month"), $("#year")); });
As you can see, I must bind twice, once for yearObj, the other for monthObj. Is there anyway to bind the change() event only once? If there are some logic mistake in using function or such as feel free to point out, since I still haven't read all the documentation yet.
I've been fiddling around with a bit of javascript in a chrome extension - something to alter the Google buzz webpage.I'm trying to find each individual post basically and have the following:
var entry =$('.X0POSb'); //This main block contains the bulk of Google buzz content console.log(entry); var items = entry.find('.G3.G2');
... but that doesn't work. It seems as though if the first selector returns no elements that the 2nd line is not executed. I might be wrong about the diagnosis, but the symptom is that I can show the log, but can't then hide it, whereas if I start with all the panels visible and remove the first selector, the hideLog event is triggered as expected.What does work is this:
I'm trying to load some html content into a page via the ajax .load() method (wrapped within the $(document).ready() function).After I execute this, I'd like to bind all new span elements from the loaded content to a context menu plugin like this:
$("#selector").contextMenu({ menu: ''myMenu'' },
[code]....
Unfortunately since the span elements are coming from the ajax request,I don't think I can bind a normal event handler as per the plugin. [URL] how to use event bubbling in this situation.
I'm using the Cycle plugin to display images for some of my past projects onhttp:[URL]..projekteMy problem is that in Chrome i get the above error in console.([cycle] terminating; zero elements found by selector) I have tried manually initializing the Cycle plugin for every project div and that did not help so I went back to my initial code:
I have collection: var collection = $(input); var i = 3; Is there easier way to get third jquery object from collection. Currently I'm using method like $(collection.get(i)) or $(collection[i]) But I think something like this could be more comfort: example: collection.get(i).addClass('....');
How can I validate a collection of fields, instead of validating the whole form? I'm using asp.net which uses one form element, which I even don't use. I have a tab panel with on each tab a couple of fields. I only want to validate the fields on a tab.
I'm using .parent on a draggable table row and need to check the contents of every cell in a particular column in the table. $(ui.draggable.parents("table")[0]) This gives me the table.. how do I get say the collection of cells in column 2. I thought about something like this: $(ui.draggable.parents("table")[0](tr td[1]))
I have a form wherein there are around 200-300 rows of homogenous data, each having around 30 input fileds of its own.So totally, there are more than 6000 input fields . Now, when the user submits this page, i need to loop through the checkboxes and identify the ones that are checked. I can't use the getElementsByName() since the checkbox names are different. I'm using getElementsByTagName("input"). Because of the huge amount of data, this method takes around 4-5 secs to evaluate before submitting the form. Is there some way to get the collection of checkboxes without having to loop through all the input fields?
I've been working on a dynamic script using the DOM and wanted a routine that would parse out the element attribute collection. I came up with a routine that works in FireFox 1.5 and Opera 8, but it doesn't work in IE 6. Any ideas? Code:
I have a .net application that I am trying to add some javascript code to for a client-side execution. What I want to do is resize all the HTML text fields on my web form, but instead of writing a line for each text box I would like to loop through a collection of controls and resize the control if it is a text field. Is there a way to do this in javascript? The function below is what I have been toying with for the past couple of hours. Another idea was to use a css, but I can't find an element for the text field.
function Test() { Tarray = new Object; Tarray = document.Form1.children for (var prop in Tarray) { //document.writeln(Tarray.toString); var s; s = prop if (Left(s, 3) == "btn") { prop.height = "20px"; } } }
I'm trying to find an example of a country selector (which also provides a state selector if USA is chosen) then you cvan select the city, any samples out there?
I am a visiting researcher at a laboratory this summer and my current task is investigating javascript obfuscation techniques. I am trying to get a relatively large sample of website containing javascript code so I can analyze it and determine if it is: 1) obfuscated 2) malicious
I have a fairly decent inference what the result will be, but it would be nice to have statistics on my side. Having said that, I believe it will be necessary to have a very large sample size to perform my analysis.
Now for my question, does anyone know if there are any ways to utilize a web browser or other component to automatically find javascript samples? Google has not yielded any results, and the code search merely searches repositories; not exactly what I need.
Short of rolling my own crawler, can anyone offer any suggestions that will aid me in my task?
'm having a very hard time making this work and be happy in both IE and Firefox. Basically, I'm setting a timeout to get an array of the form values if not present, or compare against if they are present, and if any change in values, submit the form to auto-save it.
below is my coding, basically I am using document.forms[thisformname].elements - but that gives me a lot of things that are NOT form fields and I just need to read input:text, input:checkboxk, input:radio, textarea, and select elements - nothing more. I'm open to any suggestions and some of you smart guys could probably write this in half the lines I did.
Code:
//auto-save coding var autosaveTimelapse=0; var autosaveTimeout=3; //every n seconds
I have the following nested javascript collection (below) and I'm trying to access the information within the collection using prototype so I can properly style and layout the data.
var teams = { "team1:" { "QB": "Alexander Hamilton", "RB": "John Jay",
I'm working on an Ajax library that I plan to use on several upcoming projects. Everything seems to work just great...
Now I want to get into the finer aspects of checking things... How much memory am I using, are my objects making themselves available for garbage collection adequately, etc.
Are there tools you can recommend (especially for IE and Firefox) that I can use to get this information?