[jQuery] jQuery Twitter Full API Plugin - Help Needed Testing
Hey guys, I've been working on a full implementation of the twitter API through, primarily, jQuery, with a simple relay script server side for securely signing and keeping auth details. I've just finished the library, and am looking for some developers who know either the twitter API and jQuery to help test out this new plugin. If you would like to help with this project (currently named Jitter: Jquery Twitter), please send an email to gars...@gmail.com Thanks! [Cross Posted on the Twitter Dev and jQuery Lists]
[jQuery] Re: Loading jQuery without blocking
Honestly, I'd load jQuery regularly, and use the getScript function to load the rest of the files after domready. I don't know that you're getting a big performance increase in loading the jquery library in this method, and it is causing an unknown error, which isn't an ideal thing to debug. :P Using jQuery to backload any additional plugins or scripts can be super useful, but including the jQuery library asynchronously seems like a poor decision. On Aug 6, 4:12 am, north wrote: > Hi all, > > I played around with Steve Souders' techniques of loading JS without > blocking a bit (I had already been using jQuery's getScript/ajax to > load bigger chunks of code for certain parts of the site only if > necessary). > I tried to use what Nicolas Zakas calls "the best way to load > JS" (http://www.nczonline.net/blog/2009/07/28/the-best-way-to-load- > external-javascript/) for the project I work on. > > I created the tag for jquery.js the way described in the > article, and then tried to use onload/readystate to start loading the > file with my plugins/functions right after jquery did. > > This seems to work fine in all browsers except, you guessed it, IE... > For some reason IE (I think it happened in 6, 7 and 8) throws me an > unknown error every now and then. > It's just a guess, since an "unknown error" doesn't really help me > debugging, but maybe sometimes the plugin/functions file finishes > loading before jquery. Even though that should be prevented by > checking the readystate... > > I tried several other approaches then (like adding an ajax call to the > plugins/functions file at the end of the jquery file, or checking for > (typeof jQuery == 'undefined') in a loop to try loading the files as > soon as this statement equals false), but none would work. > > Is anybody using one of these non-blocking techniques with jQuery > successfully? > > Thanks
[jQuery] Re: Remove an element but not it's content
If you want a cleaner look, you can always just throw together a quick plugin to handle things: $.unwrap = function(){ return this.each(function(){ var el = $(this); el.before( el.html() ).remove(); }) } Then, simply call: $('a.tester').unwrap(); And it will unwrap all matching tags. On Aug 6, 2:10 pm, piter wrote: > Hi, > > Not sure if sent the post but Solution is quite easy (I wouldnt even > use jQuery for this): > > For re-use purposes create function: > > function rmTags(ref){ > ref.parentNode.insertBefore( document.createTextNode > (ref.innerHTML), > ref); > return ref.parentNode.removeChild(ref); > > } > > get reference to Your link, (however You want, jQuery etc.) and invoke > function on it; > > rmTags( $("theLink") ); > > cheers > > ps. not sure if previous was sent so if it's repeated just delete it.
[jQuery] Re: More fun with decrementing on click
The problem is in how you're applying the decrement operator. If you put it at the end of the number, as in: number-- Then, the current number will be returned, THEN decremented. That's what's happening here. Simply put the operator before the number, so it is decremented THEN returned. $('.number').html( --count ); On Aug 3, 4:15 pm, littlerobothead wrote: > I have a status area in an app I'm working on. It shows the number of > unread alerts. As the user clicks each alert, it's subtracted from the > total. The following code counts the number of items to use as my > total: > > var trigger = $("#dataset-b tr.unread"); > var count = $(trigger).length; > $(".number").html(count); > > And then this works to subtract from that number on each click: > > $(trigger).click(function(){ > $(".number").html(count--); > if (count == 0){ > $(trigger).unbind("click"); > } > $(this).removeClass('unread'); > }); > > Problem is, nothing happens on the first click. However, on the second > click my number starts to decrement. What's going on here? How can I > make the count work? > > Best, > Nick
[jQuery] Re: function running 2X
Pretty sure its because the event is bubbling up. Try: $('#cardcharges td').click(function(){ alert('execute once'); return false; }); On Jul 29, 2:38 pm, marksimon wrote: > no stupid ideas here, but changing to $(#cardcharges td).click( didn't > fix the problem. > > On Jul 29, 11:22 am, András Csányi wrote: > > > > > 2009/7/29 marksimon : > > > > Any idea why this would run twice: > > > function clickcharges() { > > > $('#cardcharges tr td').click(function() { > > > alert('execute once'); > > > > }); > > > } > > > Stupid idea, but maybe... Because the td tag is part of the tr. And if > > you click the cell once means that one click on the cell and one click > > on the row... :) > > > -- > > - - > > -- Csanyi Andras --http://sayusi.hu--Sayusi Ando > > -- "Bízzál Istenben és tartsd szárazon a puskaport!".-- Cromwell
[jQuery] Re: Using data(name,value) to store additional information
You could also do it with non-styling classes, as an alternative to locating them. $('div:first').data('foo', 'bar').addClass('foo'); $('.foo'); On Jul 28, 3:15 pm, Basdub wrote: > Thanks, that should do the trick. > > On Jul 23, 10:44 pm, Karl Swedberg wrote: > > > > > One way to retrieve them is to use the .filter() method with a > > function. for example: > > > $('div').filter(function() { > > return $(this).data('foo') == 'bar'; > > > }); > > > --Karl > > > > > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > > On Jul 21, 2009, at 11:29 AM, Basdub wrote: > > > > I wanted to define additional attribute to a tag to manage > > > information. I realized that XHTML might not like it and discovered > > > the data(name,value) function. > > > > I was wondering how i could retrieve all tags e.g. "div" that have > > > that data variable set.
[jQuery] Re: JQuery and XHTML in Firefox
Can you give a sample of the output? How different is the result of the transform from valid xhtml? On Jul 28, 2:55 pm, ScottSEA wrote: > On Jul 28, 9:55 am, ScottSEA wrote: > > > Until recently, I was humming along happily with my jQuery and HTML... > > life was good. Sadly, the Powers That Be have ordained that Thou > > Shalt Useth XHTML - so let it be done. > > > I've undergone the process to convert to XHTML - all is valid and all > > is well... but no. Firefox treats XHTML as XML. jQuery is designed > > for HTML - when appending / prepending / removing it uses the innerHTML > > () function, which of course doesn't work for XML/XHTML. > > > Lest you despair, there is indeed a question in here. Does anyone > > have a recommendation for using XHTML and jQuery? I'm not overly > > excited about writing my own plugin, so if someone has already done > > the heavy lifting, could you point me in the right direction? > > Serious omission on my part: > > These are all *local* .xml files that are transformed by stylesheets > to render xhtml. Ergo, no specifying of doctype, mimetype, no server, > nuttin'. Just local files - and the is the > problem. If I change it to HTML, then everything works fine - but > it's no longer XHTML. The three options are text, xml or html - xhtml > is not a valid choice.
[jQuery] Re: JQuery and XHTML in Firefox
What doctype / mimetype are you specifying. If you're doing xhtml+xml, I'm pretty sure if you remove the "+xml" portion, things will play nicely again. On Jul 28, 12:55 pm, ScottSEA wrote: > Until recently, I was humming along happily with my jQuery and HTML... > life was good. Sadly, the Powers That Be have ordained that Thou > Shalt Useth XHTML - so let it be done. > > I've undergone the process to convert to XHTML - all is valid and all > is well... but no. Firefox treats XHTML as XML. jQuery is designed > for HTML - when appending / prepending / removing it uses the innerHTML > () function, which of course doesn't work for XML/XHTML. > > Lest you despair, there is indeed a question in here. Does anyone > have a recommendation for using XHTML and jQuery? I'm not overly > excited about writing my own plugin, so if someone has already done > the heavy lifting, could you point me in the right direction?
[jQuery] Re: Using replaceWith on a instead of a causes text to be deleted
The W3C has a list of valid self-closing tags, div of which is not one of them (for the sake of compatibility, I think). http://www.w3schools.com/xhtml/xhtml_ref_byfunc.asp Only the following tags should be self closed: On Jul 28, 11:30 am, "thorasm...@gmail.com" wrote: > Not sure whether this is a bug, but is is certainly unexpected > behaviour. > > When i try to use replaceWith on a instead of a > (which is correct HTML syntax) it causes, not only the div but all > code after the div to be replaced. > > Please see the code here: > > http://nafai.org/temp/jqueryproblem/ > > I will make a bug report if others also think this is a bug.
[jQuery] Re: consistently unable to get return false to work, why?
Try starting off with a simplifying your selectors and the code in general? .live(), in this case, isn't going to provide you much benefit, as you're binding it to an element based on an ID, which means there will only ever be a single element which this function triggers for. Try something like: $(function(){ $('#getEmail').submit(function(){ var sid = $('.emailsButton', this).attr('id'), email = $('#email'); email.after( isValidEmailAddress( email.val() ) ? 'works' : 'Email is not valid!' ); return false; }); }); On Jul 28, 12:30 pm, pedalpete wrote: > That is what i've always thought James, but Firebug isn't showing any > errors. > > I had actually edited the code and removed a context when i posted, so > that is why that element didn't have a closing quote. > > But i had been constantly changing things, and no errors. > > However, you are correct that I had an error in the JS in that I had > gone back to using $ rather than jQuery in the script, and I think > that is what was screwing this up. > > I still find it very strange that of the many, many times i've used > 'return false', i almost never get it to work the first time, and > usually, i don't see what I've changed to make it work. > > Thanks for the help. > Pete > > On Jul 27, 3:50 pm, James wrote: > > > > > If the return false fails, it's usually something wrong with parsing > > your Javascript that causes the problem. > > For example: > > $("input#email).after("works"); > > > It's missing a closing quote (") after "email". > > > On Jul 27, 12:28 pm, pedalpete wrote: > > > > Thanks John, > > > > I wasn't familiar with the .live() before, but of course I'll use that > > > where I can. > > > > Though I'm honoured and humbled by your response, unfortunately, in > > > this case, I'm using a 'submit', and the documentation says i can't > > > use .live on submit currently. (I did try and, and it didn't work). > > > > .bind doesn't seem as efficient, as I'll be regularly binding/ > > > unbinding, but I've added that anyway, and still after the alerts, the > > > form submits. > > > As the form itself is created on the fly, i've put the bind inside the > > > function which creates the form, and unbind before the form is first > > > created so that i'm not stuck with the old data. > > > > Unfortunately, i'm still stuck with the original problem, return > > > false; appears to be ignored. > > > > On Jul 27, 2:14 pm, John Resig wrote: > > > > > It looks like you're using the old liveQuery plugin. Why not just use > > > > .bind() or .live()? > > > > > --John > > > > > On Mon, Jul 27, 2009 at 5:11 PM, pedalpete wrote: > > > > > > So, this isn't related to any one bit of code, but it seems to be a > > > > > problem I run into almost everytime i need to stop a form or link for > > > > > doing what it was originally intended to do (submit). > > > > > > Now, i have used return false; many times, but it never works at > > > > > first. > > > > > I'm never sure what I end up changing, but something changes, and then > > > > > all of a sudden it works, and I am once again left stumped as to what > > > > > I did. > > > > > > Yesterday, i renamed a class, and all of a sudden, it worked. Changed > > > > > the class back, and guess what! It still works, though it hadn't > > > > > before ...r > > > > > > Today, i'm trying to use a submit, check the e-mail address and then > > > > > submit the form via ajax. > > > > > Once again, i can't seem to stop the form from submitting. > > > > > > There are no other javascript errors coming up in firefox. > > > > > my alerts work, so i'm in the right function, but then...the form > > > > > submits. > > > > > > > > > > > jQuery('div#selected form#getEmail').livequery('submit', function > > > > > (){ > > > > > var sid=jQuery('input.emailsButton', this).attr('id'); > > > > > var emailAddress=jQuery('input#email', this).val(); > > > > > alert(sid); > > > > > if(isValidEmailAddress(emailAddress)) { > > > > > alert('works'); > > > > > $("input#email).after("works"); > > > > > } else { > > > > > alert('errored'); > > > > > $("input#email, this").after(" > > > > class='error'>Email is > > > > > not > > > > > valid!"); > > > > > > } > > > > > return false; > > > > > }); > > > > > > > > > > > I've tried moving the return false; into the if/else, but no changes. > > > > > > As mentioned, i think the biggest problem isn't just with this code. > > > > > There is something I seem to be doing consistently. > > > > > > Thanks
[jQuery] Re: Make width of inner div equal outer
$('.secondLevel').css('width', $('#header').width()); On Jul 23, 1:16 pm, Paul Collins wrote: > Hi all, > I've got a problem with IE6 and I need to basically find the width of the > "header" DIV and make the "secondLevel" DIV match it. So, I guess I need to > target IE6 specifically in the code. Here's what I have: > > > > Home > > About Us > > > Overview > > > > Contact > > > > I'm not sure how to start with the script. I can calculate the width of the > "header" DIV, but not sure how to force the "secondLevel" one to match it. > > alert($("#header").width()); > > Any help would be fantastic. > Cheers > Paul
[jQuery] Re: Looking for some help converting this to jquery
function setButtonClass(){ $(':submit,:reset,:button').each(function(){ var el = $(this), val = el.val(), word = (val.split(/[^A-Z\W]/).length/2) + val.length; el.addClass( word >= 12 ? 'mb' : (word > 4 ? 'sb' : (word > 0 ? 'b' : '')) ); }) } Untested, but give it a shot. Should work fine, so long as you execute after document.ready. On Jul 23, 12:38 pm, sleepwalker wrote: > Thanks Rob I like your approach and learned a lot. This is why I like > to post code to see how others attack the same issue. I would still > like to see how someone would code this using the jquery syntax rather > then the standard javascript way, so if anyone wants to give it a go > please do. All us newbies learn a lot from this stuff so thanks again. > > Daniel
[jQuery] Re: Binding of object
In what situation in your code would more than a single event be bound to the element? On Jul 21, 11:22 am, Liam Potter wrote: > Well the way you do it would really do anything, it will just unbind, > then run the function again as it is chained? > > > > sken wrote: > > Would make sense but i think i go with my unbind solution ... thanx > > for your help.
[jQuery] Re: error jquery-1.3.2.js(line 3633)
Well, firebug shouldn't have cared as much as IE would, because of a comma inside the list of params in your POST. The last element in an object can't have a comma. Also, could you post the HTML? On Jul 6, 8:49 am, Mark wrote: > I have 3 drop down menu's where is post the value's bij a button.click > (see code below). > But when i push the button i see an error in fire bug > "POST"http://localhost/agendanieuw/handler.php 67ms jquery-1.3.2.js(line > 3633)" > I looked online for awnsers but couldn't find any. Maybe you guys can > help me. Here is my js code. > > > script> >