Hi Rene,
I've never quite understood the benefits to the plugin approach, when
you can simply create an object that uses jquery.
(I've wondered about this before on the list, but so far no one has
enlightened me.)
function Animator(container) {
this.jC = container; // this is a jquery
looks good. pointX is a global variable and can be accessed by both
functions. What's the problem?
On Apr 11, 6:13 am, Decagrog [EMAIL PROTECTED] wrote:
Hi all,
I've a newbie question about variable scope...essentially i've two
anonimous function and i need to retrieve a variable generated
Calling a $.get() on each page change click kind of defeats the point
of doing client-side paging. It will be basically be as slow as
reloading an entire new page (and you have to add some UI to show that
the page is 'loading...).
If your db has 10,000 rows, then agreed, you won't want to dump
Try creating a test page with only the js code needed for the tabs.
As for keeping content hidden during loading, I like to use a css
class called hidden.
/* css */
.hidden { display: none; }
/* html */
div class=foo hiddenI am hidden/div
On Apr 8, 1:54 pm, Glen Lipka [EMAIL PROTECTED]
infinite loop?
getready() calls sendsite() which calls getready() which calls
sendsite()...
On Apr 8, 4:06 pm, R.O.M. [EMAIL PROTECTED] wrote:
This code doesn't work in all browsers exept firefox. Why and what i
must to do?
Trouble: when button with id=newsitesubmit was pressed there is no
I've used an object to 'cache' jquery instances. Works great.
I've also used id strings to pack data. like div id=x45-64 where
the 'x' is because id's shouldn't be numeric. And the other numbers
might be your employee id or task id. I find this id method ugly, and
would rather use a javascript
were referring tooo,
but I think he was alluding to similar situations...)
Shawn
J Moore wrote:
Regarding your example of waiting for N records to come back, it is
definitely worth it to pack all those requests into a single AJAX/JSON
request. Not only are you saving the overhead
return false; is your friend. I find i have to add it to almost
every click() and submit() event.
e.g.
$('#toggletandc').click(function(){
$('div.showhide,div#tandc').toggle();
return false;
});
On Mar 7, 6:40 pm, SparrowDog [EMAIL PROTECTED] wrote:
I am using the Basic Show Hide
direction.
Now I'm curious though and want to try out some things... I'll report
back if I have any success...
Shawn
h0tzen wrote:
On 5 Mrz., 15:40, J Moore [EMAIL PROTECTED] wrote:
wouldn't nesting the methods work? e.g.
unfortunately not as some methods have to be invoked
Much like how jquery keeps the javascript out of the HTML, it's so
much cleaner to keep PHP out of the HTML as well.
Have a look at the Smarty templating system for PHP. It's awesome.
-j
On Mar 4, 11:20 am, charlie [EMAIL PROTECTED] wrote:
Hi all, the application I'm attempting to write
You might find it easier to simply create objects that use jquery,
instead of writing a jquery plugin.
The biggest advantage is that you actually have a normal instance of
an object. You can pass this instance to other objects, call other
methods on it... all the usual good stuff. (jquery
actually, your code doesn't display a link. it sets up an action when
the link is clicked.
You're missing: a href=#do something/a
There might be other problems too if you aren't even seeing the alert
message.
Download firefox and firebug. IE isn't much help for developing
javascript.
-j
On
wouldn't nesting the methods work? e.g.
script type=text/javascript
$('#comp1').trigger('load.comp1', function() {
$('#comp2').trigger('load.comp2', function() {
$('#comp3').trigger('load.comp3', function() {
if (action2()) {
// do business logic...
I think the OP is adding elements to the dom, and then wondering why
the events for the new elements aren't working.
after adding elements with .html(), you need to add the events. For
example, adding an anchor:
$(#header).html('a href=#yo/a').find('a').click(function()
{ alert('click');
wow, the lag on this list is brutal. is there any way of reducing it,
so people don't spend time responding to already-answered questions?
On Mar 5, 9:34 am, J Moore [EMAIL PROTECTED] wrote:
actually, your code doesn't display a link. it sets up an action when
the link is clicked.
You're
good tips so far.
I just wanted to add that using classes and ids works well.
a href=# id=blackbook class=showshow blackbook/a
a href=# id=redbook class=showshow redbook/a
div class=book hidden id=blackbook-contentblackbook stuff.../
div
div class=book hidden id=redbook-contentredbook
Well, a pixel could be a tiny dot or it could be 5mm. So, really,
isn't saying font-size: 11px proportional too?
It sounds like your friend needs a better screen magnifier. Increasing
just the font size in the browser is a hack.
The one build into OS X (see 'universal access' in system prefs)
does this work?
$(this).find('ul').toggle();
On Feb 12, 5:14 pm, studiobl [EMAIL PROTECTED] wrote:
I'm having trouble selecting descendents of this
So, this works to initially hide uls:
$(.treeHeader ul).toggle();
But this doesn't work to toggle them:
$(.treeHeader).click(function(){
you can't return a value from an anonymous function!
think about it: you call $.get() and pass in an anon function as a
parameter.
$.get() returns basically immediately, and then sometime later (much
later) your anon function will be called.
Where does the return value of anon go? Nowhere.
I'm using the pagination plugin at the top and bottom of a list.
Works great, except that the two instances are independent. Clicking
on page 3 in the one pagination instance will not change the other.
I've thought of various solutions/workarounds, but they all involve
getting access to the
um, use a variable?
var x = true;
$(#container).click(function() {
if (x) {
$(#container).animate({marginTop: -=237px}, slow);
} else {
$(#container).animate({marginTop: 400px}, slow);
}
x = !x;
});
On Feb 13, 3:05 pm, somedude [EMAIL PROTECTED]
This isn't specific to jQuery. One way...
var x = '{a:123,b:456}'; // json
eval('var z='+x);
z is now an object. z.a = 123, etc.
-j
On Feb 13, 3:47 pm, wolf [EMAIL PROTECTED] wrote:
hi,
what is the correct way in jQuery to decode = deserialize a JSON
string? jQuery itself can obviously
be
improved ad that was generally where I suggested the solution and
basing on Your opinion it should work.
If there are any other opinions/suggestions I'd be glad to hear them.
Thanks in advance
Best regards!
On 11 Lut, 01:55, J Moore [EMAIL PROTECTED] wrote:
You can profile javascript
How are you measuring memory leaks?
-j
On Feb 11, 10:16 am, optimalcapacity [EMAIL PROTECTED]
wrote:
I am a newbie to jQuery so this may be a simple answer...
My goal in this exercise is to return a specific html table block
(table.DetailTable) from a dynamically generated html page which
(also the 'el' variable in your code is undefined.)
On Feb 11, 1:28 pm, saidbakr [EMAIL PROTECTED] wrote:
Hi,
I think that my problem is complicated. I already done what you have
told me due to the following requirement:
I have another function used for doing form validation which I named
saidbakr, you're still not understanding how the method calls are
'asynchronous'. Read Karl's reply again. It's full of good info.
adding a return true or return false to your success or error
methods won't do anything. You need to add code to fully handle the
response. (Basically where you are
i don't see any jquery at the link you've given.
-j
On Feb 8, 3:41 pm, eltbb [EMAIL PROTECTED] wrote:
Hi,
I am using the jquery.treeview, and when first building a tree, on IE
6, the cpu usage goes up for a few seconds.
Also whenever expanding or collapsing nodes, the cpu usage seems very
that would minimize performance issues.
I do have a specific sample in mind, but this issue is rather generic I
think. Thanks for the response. I think it's a good starting point. :)
Shawn
J Moore wrote:
A simple work around is to append a character to the id to keep them
unique
You can profile javascript with firebug and see total calls for
different approaches and how long they take.
That said, $('#id') is fast, since it is basically getElementById() a
native javascript method. However, if you call $('#id') 100x, you'll
see that it's faster to cache it in a variable.
Yes, great screencast. (I think i learned a little portuguese too.)
A question about literal objects - is it fundamentally different than
using prototype?
//
// example 1: literal obj
//
var Counter = {
container = $('#counter');
start: 1,
init: function() { container.val(start); }
}
Looks to me like you're missing a closing bracket, so your 2nd click
method ($('a#enviar_jqm_trigger') is encapsulated in the first ($
('a#corregir_jqm_trigger'). No?
-j
On Feb 5, 9:12 am, Sebastián Würtz [EMAIL PROTECTED] wrote:
my script
I've heard a few people mention the building an array and then
using .join(''). I found that good-old-fashioned string concatenation
was faster - and the syntax a bit cleaner.
There's a neat test on this page. The joining arrays seems is a bit
slower for me. (Firefox on OS X)
First, I would try to optimize your code. Make sure that you are
calling as few $() methods as possible.
(e.g. build strings and set with html() instead of repeatedly calling
append() or after(). Firebug can also help you profile.)
But if your code is as tight as it can be, then why not a
Firebug shows you the HTML as it understands it. So if it doesn't look
right, it usually means you are creating invalid HTML.
The biggest problem with your example, is that you are calling
append() repeatedly, and I don't think the elements are being inserted
where you expect. What type of
Couple of thoughts:
1) $.each() is not for moving through an array. (is for doing
something to each matched DOM element) try: for(item in _json)
{ alert('item:'+item);}
2) try defining your global as an object. e.g. var _json = {};
-jason
On Jan 16, 2:17 am, Niels [EMAIL PROTECTED] wrote:
to isolate the problem, make your script dump out something like:
{a: hello}
are you sure it's not a 404? is jquery being found? It could be lots
of things...
if you haven't already, install firebug (and use firefox). It will
save you a lot of frustration.
On Jan 18, 6:13 pm, gms [EMAIL
A simple work around is to append a character to the id to keep them
unique. But also, store the ID in the parent TR.
e.g.
tr id=u4
td class=empBob Smith/td
tddiv class=1-Jan-2008link 1/div/td
/tr
Then you can get the id with
$('div.1-Jan-2008').click(function() {
var id =
37 matches
Mail list logo