JQuery :: .data() Corrupts Chaining?
Jan 22, 2010
the following code works fine, but the span is NOT a child of the Li element. Instead it is a childof UL. If I remove the .data() from the chain, that SPAN is created as a child node, like it should be.
$(".mainmenu-filter-content ul")
.append($("<li id='flt_" + data.id + "'></li>")
.data("filterdata", data))
[code]....
View 1 Replies
ADVERTISEMENT
Oct 26, 2005
Okay, so I'm trying to set the innerHTML of a <td> tag. This works in other parts of my site just fine, and it DOES set the innerHTML of this particular tag to something SIMILAR to what I tell it...but it doesn't set it to exactly what I want! I've used a bunch of alerts to see what's going on. Here's the string I send it: Code:
View 4 Replies
View Related
Apr 21, 2011
I've discovered, that remove() function can't be chained, as it runs before other functions in chain.
Is it done on purpose? I believe that calling remove() as a callback, is much more clumsy, than chaining it. Am I wrong?
View 1 Replies
View Related
Oct 4, 2009
When I click the background image, f1 gets called and executes as expected, but f2 doesn't get called after the animation in f1.
Drupal.behaviors.director = function(context) {
$("#background").mousemove(function(ev) {
var x = ev.pageX;
var y = ev.pageY;
[Code]....
View 1 Replies
View Related
Mar 5, 2010
just a quick question about syntax.What's the difference between the following functions?
$("#menu li").hover(
function(event) {
if ($(this).is(".active")) return;
[code]...
If you notice, at the end of the first hover function, there is an excess (), whereas on the second, there isn't. They are both functional. I was just curious as to why this is added sometimes and other times not.
View 2 Replies
View Related
Aug 26, 2009
is there a possibility to chain AJAX Requests? By now i have 5 AJAX Functions where one calls the next (Button Click
View 2 Replies
View Related
Sep 10, 2009
In pseudo code, here's what I'm trying to do with some text:
shrinkText.changeText.EnlargeText.
The jQuery I'm using for this:
$('span#calendarNumber').animate({
color: '#999',
fontSize: '12px'
}, 500 ).html($('#calculatorSampleInPopup1').val()).animate({
color: '#900',
fontSize: '40px'
}, 2500, 'easeOutElastic' );
What happens visually upon triggering this is this:
- HTML content changes
- text shrinks
- text enlarges
I think what is happening is that the first animation is suppose to span 500 (miliseconds?) but jQuery doesn't pause for that, it just starts the animating and goes immediate to the second event which is to change the text. In otherwords, I think it's triggering correctly, it's just not producing the visual effect I want. Is the solution to put a pause of some sort between the first two events? If so, what's the proper method?
View 3 Replies
View Related
Feb 27, 2010
There's something I can't understand. If I do:
Why does jQuery return elem1 and not the created element ? Returning the created element does much more sense to me since:
a) I already got a reference to elem1 if I need to do further manipulation.
b) I got a references to the 'div' element I've just added.
The way jQuery does it, I'll never get a references to the element I've added.
Can anybody clarify this for me? Is it a 'jquery way' to work this?
View 6 Replies
View Related
Aug 29, 2010
I haven't used jquery for quite a while and I'm trying to simply alter out the text in a div with an ID of "test" but I'm running into trouble.
Code:
var mytest = $("#test");
alert(mytest);
I'm sure it's because I've selected the div as a whole, but I've tried selecting the first child with no success.
I suppose I should first chain in a "p" selector, then select the first item, but I'm not quite sure how to do it. What I think is my closest attempt is as follows:
Code:
var mytest = $("#test").("p")[0];
alert(mytest);
View 8 Replies
View Related
Jan 21, 2010
I've been programming in jQuery for some time now, and for the first time, I came across an issue where I am writing out the location of a TD with an ID="step" to get the innerHTML with html(). I receive a null value, but when I use td:first within the chain of elements, it works.Has anyone experienced this issue or have any idea why this is not working? I've tried other TDs with diffirent IDs within the same row, and the same null result happens.Is there a possible limitation to the numbe of IDs used within the chaining of the $() call?
View 4 Replies
View Related
Jan 16, 2010
I have just written some jQuery code that had to navigate to a parent sibling then 3rd child. My code was
$(this).parent().next('ul').children('li').children('span').children('input').attr('checked', 'checked');
Is there any way to optimize this I thought this would work
$(this).parent().next('ul').children('li span input').attr('checked', 'checked');
View 6 Replies
View Related
Jun 27, 2011
I am using .ajax() to access cross-domain data using JSONP. Because I need to be able to cache the data I want to use a static name for thejsonpCallback function, so I have set the jsonpCallback option in the .ajax() request. However that appears to requires a global function whereas the auto generated function didn't (well maybe it did but that was all hidden from me).
I definitely need to be able to cache the results. Ideally I wouldn't have a global function handling the data. Is there another way to do this? If not what is the best practice way to go about using a global function these days and how do I provide it with the context of the object/module it was called from - which is where the data is needed?
View 2 Replies
View Related
Oct 5, 2011
Relatively new to jQuery but have a problem with getting data to display.Using a webform with 2 forms. User slects and inputs data into the first form, clicks a button then using jQuery .ajax submits the serialized data to a php script. The script processes the input into multiple paragraphs of text which is based on the input from the first form.The data is returned to the webpage and displayed in a text area (of the 2nd form) where the user can edit it to fine tune the wording. The 2 forms are displayed in different tabs so it is easy to move back and forward between the 2 forms.
The problem occurs when the user goes back to the first form and enters or selects different text and then click the submit button to generate a whole new text for insertion into the textarea on the second form. For certain fields the modified text is displayed.However if the whole of the text in the textarea is deleted, then the user clicks the submit button to re-generate the text content area then nothing at all is ever interted into the textarea. If have user alert to check that data is returned from the php handler and this text is correct. BUT when I click on the tab to see the textarea (id is "draftrec") there is no text inserted. The relevant function is below and the line that should insert the text into the textarea is:
$("textarea#draftrec").html(data).show();
//------------------------------------------------------
$("form#form1").submit(function(e){
[code]....
View 1 Replies
View Related
Jan 3, 2011
I would like to use jQuery to prepopulate a form - ie make a call to a php program to get data from a database and pre-populatea form with appropriate data for the user. Can anyone point me in the right direction for some examples on the simplest way to do this?
View 3 Replies
View Related
Aug 21, 2009
I wonder if i can make the variable data which is [data] in jQuery.post( url, [data], [callback], [type] ) dynamic. for instance, this is the form i want to send,
PHP Code:
<form action="send_xml.php" method="post" enctype="multipart/form-data" id="form_send"><input type="checkbox" id="var_1" class="checkbox"/><input type="checkbox" id="var_2" class="checkbox"/></form>
[Code]...
View 2 Replies
View Related
Jul 22, 2011
I am writing a small data entry screen that will post the form data to a page and return a message. But i cannot get the Success or Error functions working properly.
Here's the code where strData is the posted querystring of:
I'm not sure whether it should be in a form and using the onsubmit or click of a button.
View 2 Replies
View Related
Jul 13, 2009
I am still new to jQuery and I am trying to figure something out. I have this code:
[Code]...
This is working fine on itself. What is does is when I click a link it loads data into the following div. When done loading it slides out. But I want to change the appearance of the slide. I have tried to do that like this: $(this).show("slide", { direction: "down" }, 1000); But this doesn't work. When I check firebug it says the following: o.easing[this.options.easing || (o.easing.swing ? "swing" : "linear")] is not a function
View 1 Replies
View Related
Mar 25, 2011
Im trying to convert the contents of a canvas into a data url and then post it along with other inputs to the controller in order to save an image.
The PHP:
<
formmethod
=
"post"accept
[code]...
View 1 Replies
View Related
Oct 26, 2011
I have just started to learn about JQuery and wanted to learn how to retrieve data from an API.
I used the Flickr example provided here [url] and just changed the relevant code to point to the 500px api.
<body>
If I launch the following URL I do get the results properly [url]
Here's a sample of what the result looks like:-
I don't get any results when I run my code page. What am I doing wrong?
View 15 Replies
View Related
Oct 18, 2010
I am trying to try jQuery 1.4.3 updated .data() method with HTML5 data attributes. The way I understood these changes is that an element with these attributes would automatically have their data populated by .data(). For example, if I have an element:
<ahref="#" data-cheese="cheddar">DataElement</a>
I can access this with .data('cheddar'). This part works fine. The issue I am having is that calling JUST data like $(this).data() just produces an empty object. Is this how it should be expected to function?
View 2 Replies
View Related
Oct 6, 2011
Are there any plans to allow the .data() method to accept a map of key/value pairs of data?I don't think this is currently supported although many other jQuery methods support this type of functionality...
$('#myDiv').data({foo: true, bar: false});
View 10 Replies
View Related
Mar 31, 2011
i am thinking of using a xml file as a data base for example , the xml file stores a list of reference numbers which is allocated to a url or a name such as 0123456789 and i have a text box on a webpage and the user types in a reference number and the javascripts reads the xml file to check if its a valid reference number i.e a registered number i am new to working with xml etc.
[Code]....
id like it to read the specific data thats contained within the tag such as 0123456789's tag = JOE
View 2 Replies
View Related
Sep 9, 2011
I'm trying to compare incoming JSON data to the existing data to see if there are any changes, but for giant objects like:
Code:
[{"date":"2011-09-03 23:06:03","notifier_id":"1","type":"1","unread":"0"},{"date":"2011-09-05 00:37:46"}]
if (JSON.stringify(oldData) == JSON.stringify(newData))
This doesn't seem to work. I've tried using:
Code:
escape("'" + JSON.stringify(W.notification.list + "'"))
but that ignores the objects properties and returns something like 22%5Bobject%20Object%5D%2C%5Bobject
View 1 Replies
View Related
May 18, 2011
TEST .js
// JavaScript Document
$.post('http://example.com/test.php?image_no='+no_image, function(data) {
$('#gallery').html(data);
[code]....
View 1 Replies
View Related
Dec 5, 2011
i load a iframe in my main page and upload a image in the iframe. Now i need the data from the iframe i a DIV on the main page. I think that go with $('#iframe').contents().find('#msg'); I dont know to write this Data in a DIV on the main page
View 1 Replies
View Related
Jan 24, 2011
I am trying to get data from mysql into a variable, that should be read by protovis.
I tried
/* abfrage_LB.php echoes a json string with the data from mysql */
var parsedData;
$.post('abfrage_LB.php', function(data){
parsedData = JSON.parse(JSONdata);
});
the error message says, that parsedData is undefined. How can I display, what is in parsedData?
View 1 Replies
View Related