Re: [jQuery] Once I've downloaded it...

2010-01-15 Thread Charlie Griefer
I'd read the Getting Started section at http://docs.jquery.com/Main_Page .

On Fri, Jan 15, 2010 at 9:06 AM, Jerry je...@jerrysweet.com wrote:

 I'm a newbie and have been informed that I need to become familiar
 with jQuery.  I have downloaded it from the download page.  What do I
 do with it, now?




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Sceptic about JQuery

2010-01-13 Thread Charlie Griefer
On Wed, Jan 13, 2010 at 9:11 AM, olliewebster ollie@googlemail.comwrote:

 Hi,
 I recently came across JQuery, but I'm not sure weather I should use
 it. Even though I already know JavaScript, would I have to learn a new
 language specific to JQuery? What would the advantages of using JQuery
 be? Finally, would it be hard to install?
 Thanks


I like to think I'm fairly competent ant JavaScript, and for the longest
time, I put off learning jQuery because really... why invest the time to
learn a different way to write stuff I already know how to write?

Then I saw this:

$('#element').toggle();

That right there is the same as:

if (document.getElementById('element').style.display == none) {
 document.getElementById('element').style.display = block;
} else {
 document.getElementById('element').style.display = none;
}

As you can see, that's code to toggle the display of an element.  If it's
hidden, show it.  If it's visible, hide it.

Let's say you wanted to trigger that based on a button click.

Normally, you'd have input type=button id=myButton
onclick=toggleElement(); /

In jQuery, your script is completely unobtrusive and should never show up in
the HTML itself.

In jQuery, that same click would be up int he script area:

script
 $('#myButton').click(function() {
  $('#element').toggle();
 });
/script

So, as you can see... yes, it's taking the time to learn a new way to do
what you already know how to do... but it's a way that will save you a ton
of time.  I've changed the behaviors of HTML pages entirely without ever
touching the .html file (all done in the .js).

If it takes you a week to grok the basics (because you'll probably always be
learning)... you'll make up that week in no time just by virtue of never
having to type document.getElementById() again :)

Installing jQuery is simply a link to the jQuery.js file.

If you're storing it locally, it's script
src=my/path/to/jQuery.js/script.

You can also point to google's repository where they host the jQuery file
(as well as other libraries).

script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
/script

Add the line above, and jQuery is installed.  Go nuts :)

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] click event is not working

2010-01-07 Thread Charlie Griefer
http://docs.jquery.com/Events/live

On Thu, Jan 7, 2010 at 2:01 PM, CreativeMind aftab.pu...@gmail.com wrote:

 hi,
 i'm appending a child div in a parent div. parent div has already
 child div's which have classes ws_c1 and plus.

 $('div/div').addClass('ws_c1').addClass('plus').appendTo($
 ('#'+'parentdiv'+counter));

 but when i try to do this
  $(.ws_c1.plus).click(function() {alert('test');});
 It works on other child div's but not on the appended div's. I've also
 tried with Id's.
 can you plz help me.

 regards,




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] How to gain reference to hyperlink that is clicked

2010-01-05 Thread Charlie Griefer
input type=button id=addButton1 class=myButton /
input type=button id=addButton2 class=myButton /

script type=text/javascript
 $(document).ready(function() {
  $('.myButton').click(function() {
   alert($(this).attr('id'));
   // alert(this.id) -- should also work
  }
 });
/script

Notice that I added a class=myButton to each button element, and set the
listener for $('.myButton').click(), which listens for a click event on any
element that matches that selector.

Within the function triggered by the click event, $(this) or this are both
references to the element that triggered the click.

On Tue, Jan 5, 2010 at 12:35 PM, CoffeeAddict dschin...@gmail.com wrote:


 I understand that I can use the .click() method on a hyperlink element.
  But
 how do I know which element was clicked?  First I have to gain reference to
 the hyperlink's ID.

 So lets say I have a page of hyperlinks like this in view source:

 ...someurl  somebutton
 ...someurl  somebutton
 ...someurl  somebutton
 ...someurl  somebutton

 when a user clicks addButton1, how do I know it's addButton1 that was
 referenced so that I can now apply a .click() event on it?
 --
 View this message in context:
 http://old.nabble.com/How-to-gain-reference-to-hyperlink-that-is-clicked-tp27026713s27240p27026713.html
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Re: How to gain reference to hyperlink that is clicked

2010-01-05 Thread Charlie Griefer
On Tue, Jan 5, 2010 at 1:10 PM, Scott Sauyet scott.sau...@gmail.com wrote:

 On Jan 5, 3:43 pm, Charlie Griefer charlie.grie...@gmail.com wrote:
  Within the function triggered by the click event, $(this) or this are
 both
  references to the element that triggered the click.

 More precisely, this is a reference the to element.  $(this) is a
 reference to a jQuery wrapper object containing only that element.


Aye.  Thanks for the clarification.

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] I would like to get value each time when one of these checkboxes will change status, how can I do that ?

2009-12-27 Thread Charlie Griefer
You just want the value of the one that's checked?

$(':checkbox[name=number]').click(function() {
 if ($(this).is(':checked')) alert($(this).val());
});

if you want the total of all checked boxes when one is clicked:
script type=text/javascript
$(document).ready(function() {
$(':checkbox[name=number]').click(function() {
var total = 0;
$(':checkbox[name=number]:checked').each(function() {
total += parseFloat($(this).val());
});
alert(total);
});
});
/script

On Sun, Dec 27, 2009 at 1:08 PM, dziobacz aaabbbcccda...@gmail.com wrote:

 I have:

 input type=checkbox checked=checked value=2 name=number/
 input type=checkbox value=7 name=number/
 input type=checkbox value=34 name=number/

 I would like to get value each time when one of these checkboxes will
 change status, how can I do that ? For example when first checkbox
 will be unchecked or second will be checked. Could You help me ?





-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Re: I would like to get value each time when one of these checkboxes will change status, how can I do that ?

2009-12-27 Thread Charlie Griefer
Wow.  Never even thought about that, but it makes perfect sense.

Thanks for pointing that out :)

On Sun, Dec 27, 2009 at 5:52 PM, Ami aminad...@gmail.com wrote:

 I recommend to use change event and not click event, becuase users
 can change the checkbox without clicking (by using the keyboard).

 On Dec 28, 1:17 am, Charlie Griefer charlie.grie...@gmail.com wrote:
  You just want the value of the one that's checked?
 
  $(':checkbox[name=number]').click(function() {
   if ($(this).is(':checked')) alert($(this).val());
 
  });
 
  if you want the total of all checked boxes when one is clicked:
  script type=text/javascript
  $(document).ready(function() {
  $(':checkbox[name=number]').click(function() {
  var total = 0;
  $(':checkbox[name=number]:checked').each(function() {
  total += parseFloat($(this).val());
  });
  alert(total);
  });
  });
  /script
 
  On Sun, Dec 27, 2009 at 1:08 PM, dziobacz aaabbbcccda...@gmail.com
 wrote:
   I have:
 
   input type=checkbox checked=checked value=2 name=number/
   input type=checkbox value=7 name=number/
   input type=checkbox value=34 name=number/
 
   I would like to get value each time when one of these checkboxes will
   change status, how can I do that ? For example when first checkbox
   will be unchecked or second will be checked. Could You help me ?
 
  --
  Charlie Grieferhttp://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Latest JQuery File

2009-12-23 Thread Charlie Griefer
I'd wager this is an issue with Dreamweaver's parsing of the code.

You should -not- be modifying the core jQuery files, unless you really
-really- know what you're doing.  And if that's the case, you still really
should -not- be modifying the core jQuery files.

On Tue, Dec 22, 2009 at 11:34 PM, David Matchoulian 
davidmatchoul...@gmail.com wrote:

 Dear jQuery Guys,
 I downloaded the latest file, and when i opened it in dreamweaver and
 scrolled through the code i noticed that half the code is colored
 blue, that is half the code is considered string, i tryed to fix it
 myself but i didn't since i was afraid that i might ruin the code.
 What is the solution for this problem?
 Thank you




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Targeting/selecting via the title atribute of a link?

2009-12-23 Thread Charlie Griefer
$('a[title=blog]')

On Wed, Dec 23, 2009 at 8:30 AM, Janmansilver jan.poul...@gmail.com wrote:

 I have to add som jquery magic to a link where the only unique
 identifier is the title-atribute?

 my code:

 a title=Blog href=/blog

 How do I target this via Jquery?




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Sending all checked checkboxes

2009-12-23 Thread Charlie Griefer
If I'm understanding you properly...

$('input:checkbox.filter:checked') would give you an array of checked
checkboxes with class=filter

How you send them via AJAX depends on what the file on the server is
expecting.

On Wed, Dec 23, 2009 at 9:46 AM, spiraldev spiral...@gmail.com wrote:

 How would I go about send all of my checked checkboxes with the class
 of filter via ajax?




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] .add()

2009-12-23 Thread Charlie Griefer
As per the docs (http://docs.jquery.com/Traversing/add),

$(div).css(border, 2px solid red)
.add(p)
.css(background, yellow);

That will add a 2px red border around any 'div' element.

Then add in a new selector and grab all of the p elements.  Add a yellow
background to the previously selected div elements, as well as the newly
selected p elements.

Does that clarify add()?

I'm not sure I understand what it is you're trying to accomplish.  Can you
explain what you need to do?

On Wed, Dec 23, 2009 at 10:45 AM, Scott polyp...@gmail.com wrote:

 Maybe I'm not understanding the point of .add() but it doesn't really
 do what I'd expect nor can I figure out how to do what I thought would
 be simple.

 I want to combine 2 jquery objects.

 var $obj1 = $(.stuff);
 var $obj2 = $(.morestuff);
 $obj1.add($obj2);
 alert($obj1.length);

 This doesn't do anything, it looks like .add() only accepts selection
 strings which in my example would work but in what I really need to do
 I have no selection string which would find the specific jquery
 objects.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Re: .add()

2009-12-23 Thread Charlie Griefer
Sorry, misunderstood.

I wasn't clear on what you were trying to do, but saw the Maybe I'm not
understanding the point of .add(), so was trying to clarify that.

Glad MorningZ got you sorted :)

On Wed, Dec 23, 2009 at 10:59 AM, Scott polyp...@gmail.com wrote:

 Uh, that's not what I'm asking at all.

 In the documentation example you're passing .add() the p selector
 which is a string. I want the end result to be the same except instead
 of passing a selector string like p I want to pass an existing
 jquery object. It doesn't seem to work this way and the only time more
 elements get added to to jquery object is if you use a selector.

 Sso I want to do more like :
 $(div).css(border, 2px solid red)
 .add($(this).children()) //see how this line is different
.css(background, yellow);


 On Dec 23, 12:50 pm, Charlie Griefer charlie.grie...@gmail.com
 wrote:
  As per the docs (http://docs.jquery.com/Traversing/add),
 
  $(div).css(border, 2px solid red)
  .add(p)
  .css(background, yellow);
 
  That will add a 2px red border around any 'div' element.
 
  Then add in a new selector and grab all of the p elements.  Add a
 yellow
  background to the previously selected div elements, as well as the
 newly
  selected p elements.
 
  Does that clarify add()?
 
  I'm not sure I understand what it is you're trying to accomplish.  Can
 you
  explain what you need to do?
 
 
 
  On Wed, Dec 23, 2009 at 10:45 AM, Scott polyp...@gmail.com wrote:
   Maybe I'm not understanding the point of .add() but it doesn't really
   do what I'd expect nor can I figure out how to do what I thought would
   be simple.
 
   I want to combine 2 jquery objects.
 
   var $obj1 = $(.stuff);
   var $obj2 = $(.morestuff);
   $obj1.add($obj2);
   alert($obj1.length);
 
   This doesn't do anything, it looks like .add() only accepts selection
   strings which in my example would work but in what I really need to do
   I have no selection string which would find the specific jquery
   objects.
 
  --
  Charlie Grieferhttp://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Re: jQuery Selector Help

2009-12-22 Thread Charlie Griefer
2009/12/22 Šime Vidas sime.vi...@gmail.com

 Well, you selected BR elements, which are empty elements, so it's no
 mystery why this.innerHTML returns undefined...

 Also, DIVs shouldn't appear inside SPANs...


He did state that he's using generated HTML.  He has no control over it.

Mike - this isn't really a jQuery problem per se.  You're jQuery selectors
match DOM elements.  Not so much the contents of those elements.

What you can do is search for the containing element (in this case, you can
look for a span with a class of event), and replace all instances of br
/* with just the br /.

$(document).ready(function() {
var newHTML = $('span.event').html().replace(/(br.*)\s*\*/g, '$1');
$('span.event').html(newHTML);
});

The expression is looking for a br / (or br or br/) followed by any
white space (including tabs), followed by an asterisk.  It replaces that
pattern with the br / alone (removing the asterisk).

Disclaimer: I'm no regex guru, so if anyone sees a way to clean up that
expression, please feel free.

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Re: jQuery Selector Help

2009-12-22 Thread Charlie Griefer
On Tue, Dec 22, 2009 at 10:34 AM, Mike Walsh mike_wa...@mindspring.comwrote:


 [ ... snipped ... ]

 Thanks for pointing me in the right direction.  This is what I ended
 up getting to work:

jQuery(span.event, .calendar-table).each(function(){
var html = this.innerHTML.replace(/(br\s*\/*)\s*\*/
 g, \'$1\');
jQuery(this).html(html) ;
}) ;

 I changed the regular expression slightly to eliminate the .* portion
 and changed .html() to .innerHTML.  I don't know enough jQuery to know
 why I had to do that but had seen it elsewhere so tried it and it
 worked.

 Thanks,

 Mike


.html() retrieves the innerHTML.

Really no functional difference, but for the sake of consistency, since
you're leveraging jQuery, I'd prefer to see consistent jQuery code (unless
there's a compelling reason not to).

And yeah... just a preference.  Not saying wrong or right.  But I am saying
you shouldn't have -had- to do that :)

Anyway, glad you got it working.  That's the important bit :)

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Re: jQuery Selector Help

2009-12-22 Thread Charlie Griefer
On Tue, Dec 22, 2009 at 10:40 AM, Charlie Griefer charlie.grie...@gmail.com
 wrote:

 On Tue, Dec 22, 2009 at 10:34 AM, Mike Walsh mike_wa...@mindspring.comwrote:


 [ ... snipped ... ]

 Thanks for pointing me in the right direction.  This is what I ended
 up getting to work:

jQuery(span.event, .calendar-table).each(function(){
var html = this.innerHTML.replace(/(br\s*\/*)\s*\*/
 g, \'$1\');
jQuery(this).html(html) ;
}) ;

 I changed the regular expression slightly to eliminate the .* portion
 and changed .html() to .innerHTML.  I don't know enough jQuery to know
 why I had to do that but had seen it elsewhere so tried it and it
 worked.

 Thanks,

 Mike


 .html() retrieves the innerHTML.

 Really no functional difference, but for the sake of consistency, since
 you're leveraging jQuery, I'd prefer to see consistent jQuery code (unless
 there's a compelling reason not to).

 And yeah... just a preference.  Not saying wrong or right.  But I am saying
 you shouldn't have -had- to do that :)

 Anyway, glad you got it working.  That's the important bit :)


... and after looking at your code (which always helps), I see you're
referencing this (as opposed to jQuery's $(this)), which is why html()
wouldn't have worked.

In that case, sure.  It's been said that this is more efficient than
creating a jQuery reference to it via $(this).

So to clarify... this.innerHTML is the functional equivalent of
$(this).html(), but without the cost of creating a new jQuery object for
each iteration of your each().

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] simple code not working

2009-12-21 Thread Charlie Griefer
couple of debugging steps I'd take:

1) remove the .getJSON() call and just alert('foo'), to ensure that the
change event is being triggered as you expect
2) install Firebug in Firefox and check whether or not there are errors in
the php document.

On Mon, Dec 21, 2009 at 8:16 AM, kikloo tbha...@gmail.com wrote:

 hi

 i have this simple code:

 $(function() {
$(select#ctlByName).change(function() {

cid = $(this).val();
$.getJSON(ajax.php,{cid:cid}, function(json) {
alert(Data Loaded:  + json);
})
})
 })

 and its not working. Its set to work when a select is changed by
 user and it should then get data back from ajax.php which is sending
 the data fine. But no alert is coming up and it seems its not working.

 Please help.

 Thanks.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] What is the canonical way of seeing if a selector returns an empty list?

2009-12-17 Thread Charlie Griefer
On Thu, Dec 17, 2009 at 7:32 AM, Joe Grossberg
joegrossberg@gmail.comwrote:

 Instead, I do it like this (since zero is false-y in JavaScript):

 if ( $('.foo').length ) {
  alert('at least one matching element');
 } else {
  alert('nothing matches');
 }

 But is that the preferred way of doing this?


As far as I am aware, yes... checking the length property is the way that
I've seen it done.

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Changing colspan with jQuery

2009-12-17 Thread Charlie Griefer
I see where you're changing background colors, but where are you trying to
change colspans?

untested, but

 $('myTDelement').attr('colspan', x);

... where 'x' is the numeric value, should work.

also, it's criminal to use document.getElementById() within jQuery.
$('#element') is so much more elegant :)

script type=text/javascript
$(document).ready(function() {
$('#plusSign').click(function() {
$('.ba_toggle').toggle();

   if $('#plusSign').html() == +) {
   $('#plusSign').html('-');
$('th.ba_colspan, td.ba_colspan').each(function() {
$(this).attr('bgColor','red');
});
   } else {
   $('#plusSign').html('+');
$('th.ba_colspan, td.ba_colspan').each(function() {
$(this).attr('bgColor','green');
});
   }

   });
});
/script


On Thu, Dec 17, 2009 at 11:23 AM, davec dcah...@hyphensolutions.com wrote:

 I am trying to change the colspan attribute on some table cells when
 the user clicks on a button but it is not affecting the table. Perhaps
 someone can tell me what I am doing wrong. Here is my jQuery code:

 script type=text/javascript
 $(document).ready(function() {
   $('#plusSign').click(function(){
  $('.ba_toggle').toggle();
if(document.getElementById('plusSign').innerHTML=='+')
{
   document.getElementById('plusSign').innerHTML='-';
   $('th.ba_colspan, td.ba_colspan').each(function(){
$(this).attr('bgColor','red');
   });
}
else
{
document.getElementById('plusSign').innerHTML='+';
$('th.ba_colspan, td.ba_colspan').each(function(){
$(this).attr('bgColor','green');
});
}
 });
  });
 /script




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] How do I select all elements whose id's begin with ... ?

2009-12-15 Thread Charlie Griefer
$('input[id^=DatePref]')

On Tue, Dec 15, 2009 at 8:10 AM, laredotorn...@zipmail.com 
laredotorn...@zipmail.com wrote:

 Hi,

 I'm using JQuery 1.3.  How do I write an expression to select all
 elements whose id's begin with DatePref?  These are all input
 type=text elements if that matters.

 Thanks, - Dave




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] fading

2009-12-10 Thread Charlie Griefer
Show us yours, first :)

On Thu, Dec 10, 2009 at 6:32 AM, jnf555 johnfrearson...@btinternet.comwrote:

 hi
 i am trying to ceate a page where one image fades in over another int
 the same position

 can anyone show me the code
 thanks
 jnf555




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Problem with assigning events to ajax generated content.

2009-12-09 Thread Charlie Griefer
Take a gander at the live() method:

http://docs.jquery.com/Events/live

On Tue, Dec 8, 2009 at 4:20 PM, Jeff Berry crazedprim...@gmail.com wrote:

 I am populating an unordered list with items from an ajax query, after
 which I want to attach click events to each list item.   Using either load
 or $.get I'm able to retrieve the data and post it to the UL correctly.
 However, when I then try to immediately retrieve all the list items in that
 newly populated UL, I get zero items returned and thus can't attach click
 events to them.  The UL is not actually being populated until after all of
 the scripting runs.  If I then rerun the operation I can retreive the items
 in the list from the first ajax query, but this is too late because the list
 is out of date and does not reflect the new data retrieved from the second
 query.  So, obviously I don't understand something about the basic order of
 operations here.


   function populateCategories() {
   //This loads the categories UL.  Once the script runs the items are
 listed correctly.
   $(#categories).load(
 http://localhost/my_account/return_categories.php);

  //But when I try to immediately retreive the list items from that UL
 before scripting has run it's course, the items are not available.
  //This returns a count of zero items in the list.
  var count = $(categories li).size();
  alert(count);

   }

 What can I do to get that list of items and attach click events to them
 immediately after the load has returned data and I've populated the UL?  Is
 there a different way to approach this? The point of this is to be able to
 click a button to create a new item, have that written to the database,
 update the list of items to reflect the addition, and then attach a click
 event to the list items allowing the user to select and edit the items.

 Is there a way to attach events to any list item in the UL without having
 to explicitly apply it to each item?




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] learn

2009-12-08 Thread Charlie Griefer
read http://docs.jquery.com

search amazon for jQuery.  there are a few books.

On Tue, Dec 8, 2009 at 2:24 AM, police atharikmoha...@gmail.com wrote:

 hi guys, i am interested learn j query, how to learn, can u send any
 easy way to learn site?




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] unsub

2009-12-08 Thread Charlie Griefer
Here's a link.

http://groups.google.com/group/jquery-en

On Tue, Dec 8, 2009 at 1:26 PM, Lucas Deaver luk...@gmail.com wrote:

 I need to unsubscribe from your incessant emails but you put no link in the
 email for this. It is common practice since the stone age of emails to do
 that, you are very frustrating to work with and I don't like you now.

 PLEASE UNSUBSCRIBE ME!!




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Jquery unique ID

2009-12-05 Thread Charlie Griefer
script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js
/script

script type=text/javascript
$(document).ready(function() {
$('div.testClass').each(function(i) {
$(this).attr('id', 'test' + i)
});
});
/script

div class=testClassA/div
div class=testClassB/div
div class=testClassC/div

$('div.testClass').each(function(i) -- will loop over each instance of a
div with the class testClass.

For each iteration of the loop, 'i' is the loop index (e.g. for 1st
iteration its value is 1, second iteration, 2, etc).

So for each loop, you set the id attribute of the div being looped over to
testi (where i represents a number).

You'll end up with the first div having an ID of test1, the second an id
of test2, etc.

If you run the code above in Firefox using Firebug, you should be able to
see the attributes in the code.

On Sat, Dec 5, 2009 at 4:42 AM, kbuntu i...@teevotee.com wrote:

 I'm a designer and totally lost when it comes to php or java script.
 Perhaps somebody can help me.

 I have several images when hover over it will display a DIV called
 testing. The content is dynamically generated by wordpress. My problem
 is when I hover over an image it displays all the div's with the class
 testing. What I need to do is somehow generate a random id by
 Jquery.


 script type=text/javascript
$(document).ready(function() {
var hide = false;
$(.rss-link).hover(function(){
if (hide) clearTimeout(hide);
$(.testing).fadeIn();
}, function() {
hide = setTimeout(function() {$(.testing).fadeOut
 (slow);}, 500);
});
$(.testing).hover(function(){
if (hide) clearTimeout(hide);
}, function() {
hide = setTimeout(function() {$(.testing).fadeOut
 (slow);}, 500);
});
});
 /script


 div class=testing style=display: none;this is my dynamic created
 content /div

 Thank you in advance.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] How do I trigger an event when a user presses a key within a text field?

2009-12-05 Thread Charlie Griefer
On Sat, Dec 5, 2009 at 1:16 PM, laredotorn...@zipmail.com 
laredotorn...@gmail.com wrote:

 Hi,

 What is the event that I trigger if a user enters (or deletes) a
 character within a textfield with id = username?

 Thanks,  - Dave


Bet you can find it in here: http://docs.jquery.com/Events

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Basic Bind Question

2009-12-04 Thread Charlie Griefer
Hi All:

I've read over the docs, but don't quite understand what the bind() event
provides versus just assigning a particular event handler to a selected
element (or set of elements).

For example, consider the code below.  What's the difference between the
interaction with the p elements of class first, and the p elements of
class second?  Isn't the second bit effectively binding a click event
handler to a specific batch of p elements just as the first one is?

Just not grokking it.  Would appreciate if anybody could enlighten me.

script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js
/script

script type=text/javascript
$(document).ready(function() {
$('p.first').bind('click', function() {
alert($(this).text());
});

$('p.second').click(function() {
alert($(this).text());
});
});
/script

p class=firstA/p
p class=firstB/p
p class=firstC/p
p class=firstD/p
p class=firstE/p

hr /

p class=secondF/p
p class=secondG/p
p class=secondH/p
p class=secondI/p
p class=secondJ/p

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Basic Bind Question

2009-12-04 Thread Charlie Griefer
Hi Karl:

Awesome!  Got it :)

Thanks for the explanation and examples.

Charlie

On Fri, Dec 4, 2009 at 9:01 AM, Karl Swedberg k...@englishrules.com wrote:

 Hey Charlie,

 methods such as .click() and .mouseover() are just convenience methods.
 They all use .bind() internally. One nice thing about .bind() is that you
 can use multiple event types with it. For example, instead of doing this:

 $('a')
   .mouseover(function() {
 var $link = $(this);
 // do something with $link
   })
   .mouseout(function() {
 var $link = $(this);
 // do something with $link
   });

 You can combine them and avoid some repetition:

 $('a')
   .bind('mouseover mouseout', function(event) {
 var $link = $(this);
 if (event.type == 'mouseover') {
   // do something with $link on mouseover
 } else {
   // do something with $link on mouseout
 }
   });

 --Karl

 
 Karl Swedberg
 www.englishrules.com
 www.learningjquery.com




 On Dec 4, 2009, at 11:46 AM, Charlie Griefer wrote:

 Hi All:

 I've read over the docs, but don't quite understand what the bind() event
 provides versus just assigning a particular event handler to a selected
 element (or set of elements).

 For example, consider the code below.  What's the difference between the
 interaction with the p elements of class first, and the p elements of
 class second?  Isn't the second bit effectively binding a click event
 handler to a specific batch of p elements just as the first one is?

 Just not grokking it.  Would appreciate if anybody could enlighten me.

 script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js
 /script

 script type=text/javascript
 $(document).ready(function() {
 $('p.first').bind('click', function() {
 alert($(this).text());
 });

 $('p.second').click(function() {
 alert($(this).text());
 });
 });
 /script

 p class=firstA/p
 p class=firstB/p
 p class=firstC/p
 p class=firstD/p
 p class=firstE/p

 hr /

 p class=secondF/p
 p class=secondG/p
 p class=secondH/p
 p class=secondI/p
 p class=secondJ/p

 --
 Charlie Griefer
 http://charlie.griefer.com/

 I have failed as much as I have succeeded. But I love my life. I love my
 wife. And I wish you my kind of success.





-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Re: Basic Bind Question

2009-12-04 Thread Charlie Griefer
Thanks all.  I appreciate all the responses and examples.  Really helps out
a lot.

Charlie

On Fri, Dec 4, 2009 at 11:34 AM, seasoup seas...@gmail.com wrote:

 Got two more uses for ya.  Namespacing of events:

 // set two click events with different namespaces
 $('.button').bind('click.namespace1', function () {

 }).bind('click.namespace2', function () {

 });

 //remove just one of them
 $('.button').unbind('click.namespace1', function () {

 });

 and passing of data:

 $('.button').bind('click', {'name': 'value'}, function (e) {
  console.log(e.data.name);  // logs value
 });





 On Dec 4, 10:41 am, Rey Bango r...@reybango.com wrote:
  Yep Karl's explanation was great. Also, you can leverage bind() to work
  with your own custom events in the case where you want to define
  something that needs to be triggered based on another action. Using the
  code from the docs, you can see what I'm talking about:
 
  $(p).bind(myCustomEvent, function(e, myName, myValue){
 $(this).text(myName + , hi there!);
 $(span).stop().css(opacity, 1)
  .text(myName =  + myName)
  .fadeIn(30).fadeOut(1000);
   });
  $(button).click(function () {
 $(p).trigger(myCustomEvent, [ John ]);
   });
 
  Rey...
 
  Charlie Griefer wrote:
   Hi Karl:
 
   Awesome!  Got it :)
 
   Thanks for the explanation and examples.
 
   Charlie
 
   On Fri, Dec 4, 2009 at 9:01 AM, Karl Swedberg k...@englishrules.com
   mailto:k...@englishrules.com wrote:
 
   Hey Charlie,
 
   methods such as .click() and .mouseover() are just convenience
   methods. They all use .bind() internally. One nice thing about
   .bind() is that you can use multiple event types with it. For
   example, instead of doing this:
 
   $('a')
 .mouseover(function() {
   var $link = $(this);
   // do something with $link
 })
 .mouseout(function() {
   var $link = $(this);
   // do something with $link
 });
 
   You can combine them and avoid some repetition:
 
   $('a')
 .bind('mouseover mouseout', function(event) {
   var $link = $(this);
   if (event.type == 'mouseover') {
 // do something with $link on mouseover
   } else {
 // do something with $link on mouseout
   }
 });
 
   --Karl
 
   
   Karl Swedberg
  www.englishrules.comhttp://www.englishrules.com
  www.learningjquery.comhttp://www.learningjquery.com
 
   On Dec 4, 2009, at 11:46 AM, Charlie Griefer wrote:
 
   Hi All:
 
   I've read over the docs, but don't quite understand what the
   bind() event provides versus just assigning a particular event
   handler to a selected element (or set of elements).
 
   For example, consider the code below.  What's the difference
   between the interaction with the p elements of class first,
   and the p elements of class second?  Isn't the second bit
   effectively binding a click event handler to a specific batch of
   p elements just as the first one is?
 
   Just not grokking it.  Would appreciate if anybody could enlighten
 me.
 
   script
   src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js
 /script
 
   script type=text/javascript
   $(document).ready(function() {
   $('p.first').bind('click', function() {
   alert($(this).text());
   });
 
   $('p.second').click(function() {
   alert($(this).text());
   });
   });
   /script
 
   p class=firstA/p
   p class=firstB/p
   p class=firstC/p
   p class=firstD/p
   p class=firstE/p
 
   hr /
 
   p class=secondF/p
   p class=secondG/p
   p class=secondH/p
   p class=secondI/p
   p class=secondJ/p
 
   --
   Charlie Griefer
  http://charlie.griefer.com/
 
   I have failed as much as I have succeeded. But I love my life. I
   love my wife. And I wish you my kind of success.
 
   --
   Charlie Griefer
  http://charlie.griefer.com/
 
   I have failed as much as I have succeeded. But I love my life. I love
 my
   wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] books to help indoctrinate java developers?

2009-11-24 Thread Charlie Griefer
On Tue, Nov 24, 2009 at 7:24 AM, mattkime mattk...@gmail.com wrote:

 I recently convinced my company to go with jQuery. (yaaay!) and now
 i've been tasked with spreading my knowledge around. i was curious if
 anyone could recommend books to put in the hands of experienced
 programmers who are new to javascript. for the basics, I'd point them
 to JavaScript: The Good Parts. what about more advanced js books and
 jquery specific books? i've taught myself with online resources but
 these people are asking specifically about dead tree resources.


http://www.amazon.com/jQuery-Action-Bear-Bibeault/dp/1933988355/177-2519159-8655561?SubscriptionId=1SDRSQH20CF1ZSXE6Y02

http://www.amazon.com/Learning-jQuery-1-3-Jonathan-Chaffer/dp/1847196705/ref=pd_bxgy_b_text_b

http://jqueryenlightenment.com/

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Trouble with IE breaking script

2009-11-19 Thread Charlie Griefer
What version of IE?
Define break?

On Thu, Nov 19, 2009 at 11:29 AM, Atkinson, Sarah 
sarah.atkin...@cookmedical.com wrote:

  I’m having trouble with IE
 This code seems to break in IE

 var cssString= label.error{left:+leftOffset+px;};$('head
 style').text(cssString);




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Trouble with IE breaking script

2009-11-19 Thread Charlie Griefer
leftOffset is a variable you're defining somewhere?

On Thu, Nov 19, 2009 at 11:39 AM, Atkinson, Sarah 
sarah.atkin...@cookmedical.com wrote:


 IE 7 haven’t tried any others. And it doesn’t work it doesn’t text and it
 cause another function that hides and shows a div to not work as well.  The
 only fire bug error I get is Reload to activate window console although IE
 has a message saying error on page


 On 11/19/09 2:35 PM, Charlie Griefer charlie.grie...@gmail.com wrote:

 What version of IE?
 Define break?

 On Thu, Nov 19, 2009 at 11:29 AM, Atkinson, Sarah 
 sarah.atkin...@cookmedical.com wrote:

 I’m having trouble with IE
 This code seems to break in IE

 var cssString= label.error{left:+leftOffset+px;};$('head
 style').text(cssString);






-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Trouble with IE breaking script

2009-11-19 Thread Charlie Griefer
This may just be another example of IE sucking.  I get an error on IE 6,
unexpected call to method or property access.

Googling that error message (and adding 'style' to the search) suggests that
manipulating the style attribute dynamically on IE is somewhat...
problematic :\

On Thu, Nov 19, 2009 at 11:45 AM, Atkinson, Sarah 
sarah.atkin...@cookmedical.com wrote:



 Yes In the function that this bit of code resides


 On 11/19/09 2:43 PM, Charlie Griefer charlie.grie...@gmail.com wrote:

 leftOffset is a variable you're defining somewhere?

 On Thu, Nov 19, 2009 at 11:39 AM, Atkinson, Sarah 
 sarah.atkin...@cookmedical.com wrote:


 IE 7 haven’t tried any others. And it doesn’t work it doesn’t text and it
 cause another function that hides and shows a div to not work as well.  The
 only fire bug error I get is Reload to activate window console although IE
 has a message saying error on page


 On 11/19/09 2:35 PM, Charlie Griefer charlie.grie...@gmail.com 
 http://charlie.grie...@gmail.com  wrote:

 What version of IE?
 Define break?

 On Thu, Nov 19, 2009 at 11:29 AM, Atkinson, Sarah 
 sarah.atkin...@cookmedical.com http://sarah.atkin...@cookmedical.com 
 wrote:

 I’m having trouble with IE
 This code seems to break in IE

 var cssString= label.error{left:+leftOffset+px;};$('head
 style').text(cssString);








-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] What is the opposite of :checked?

2009-11-19 Thread Charlie Griefer
http://docs.jquery.com/Selectors/not

On Thu, Nov 19, 2009 at 12:55 PM, Atkinson, Sarah 
sarah.atkin...@cookmedical.com wrote:

  What is the opposite of :checked?

 Is it :unchecked? Or would you use the not (!)




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] show/hide div on select change

2009-11-18 Thread Charlie Griefer
You're missing a $ on this line:

('#id_status').change(function() {

Change to:

$('#id_status').change(function() {

unsolicited word of advice... run firebug :)

On Wed, Nov 18, 2009 at 11:44 AM, mtuller mitul...@gmail.com wrote:

 I am trying to have a div show and hide based on the value of a select
 list. I have looked at a number of examples, but can't seem to get it
 to work. Would appreciate someone taking a look at what I have and
 giving me any advice.

 script
 $(document).ready(function() {
$('div.textfield1').hide();

('#id_status').change(function() {

if ($(#id_status).val() == 6){
$('div.textfield1').show();
}
else{
$('div.textfield1').hide();
}
   });
 });
 /script

 plabel for=id_statusStatus:/label
select name=status id=id_status
option value=1New/option
option value=2In Review/option
option value=3Working On/option
option value=4Elevated/option
option value=5Approved/option
option value=6Deferred/option
option value=7Denied/option
option value=8Duplicate/option
option value=9Completed/option
option value=10Needs more information/option
/select/p

 div class=textfield1
 labeltest
input type=text name=text id=text /
  /label
 /div




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] imitate link

2009-11-17 Thread Charlie Griefer
On Tue, Nov 17, 2009 at 6:56 PM, runrunforest craigco...@gmail.com wrote:

 Can make b behave as a ?

 For exmaple, I have bHome/b, I want to go to homepage when i click
 b.


Why would you not just use CSS to style an a element to be bold and not
underlined?

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] sending a html part to a printer

2009-11-11 Thread Charlie Griefer
On Wed, Nov 11, 2009 at 9:54 AM, theUnseen themba.ntl...@gmail.com wrote:

 Hi guys, is it possible to print a part of the html page using JQuery
 and printed copy must not include the browser addons like datetime and
 the url. I want the print out to be a plain document with just data
 (Ms Word look alike print out)

 Thank you in advance!


AFAIK, the browser addons are local user preferences, and I don't think
they can be manipulated via code.

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Re: JavaScript switched off

2009-11-10 Thread Charlie Griefer
Scott's solution, as he mentioned, goes the other way, but still does what
the OP wanted.

If the user doesn't have JS enabled, the location.href won't fire, and the
current page will still render fine.  If the user does have JS enabled, the
location.href call will redirect them to the JS-enhanced page.

The OP was looking for a W3C compliant solution.  AFAIK, Scott's option fits
that bill.

On Tue, Nov 10, 2009 at 9:20 AM, waseem sabjee waseemsab...@gmail.comwrote:

 the op wanted to redirect without javascript


 On Tue, Nov 10, 2009 at 7:02 PM, Scott Sauyet scott.sau...@gmail.comwrote:

 On Nov 10, 10:53 am, factoringcompare.com
 firstfacto...@googlemail.com wrote:
  What’s the best way to redirect when a users browser has JavaScript
  switched off?

 How about going the other way?

document.location.href=enabled.html;

 Better still when possible is to unobtrusively enhance the non-js page
 with additional functionality.  That is generally the cleanest way of
 making sure that your content is accessible, available to search
 engines, and still has all your cool dynamic behavior for those with
 JS on.

  -- Scott





-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Confirm Delete

2009-11-09 Thread Charlie Griefer
On Mon, Nov 9, 2009 at 8:58 AM, Dave Maharaj :: WidePixels.com 
d...@widepixels.com wrote:

  I am attempting to add a class to a div before deleting it. I just cant
 get the class  to remove if the user selects no.

 Anyone have tips or a link with suggestions? I found the jquery.confirm.js
 script but unable to add a class to the element being deleted before confirm


Hard to give guidance without seeing what code you are using now.

Also, in your first paragraph you say I just cant get the class to
remove.
In your second paragraph, you say you are unable to add a class.  So not
sure which it is.

Either way, $('#myDiv').addClass('className'); or
$('#myDiv').removeClass('className') should be all you need.

If those aren't working out, seeing some code would go a long way towards
helping to troubleshoot.

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] jquery form and myfom

2009-11-09 Thread Charlie Griefer
On Mon, Nov 9, 2009 at 2:16 PM, Lord Gustavo Miguel Angel 
goosfanc...@gmail.com wrote:

 hi,
 jquery form only work if name of form is myform? is correct afirmation?


there are no such restrictions/limitations.

Any page element can have any valid name value (any valid value for any
attribute, actually).

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] jquery form and myfom

2009-11-09 Thread Charlie Griefer
name your elements with whatever name you want.

form name=gustavo id=xyz class=blah

can be selected via:

$('#xyz')
$('.blah') (this will return an array of -all- elements of class blah)
$('form') (this will return an array of -all- form elements on the pag)
$('form[name=gustavo]')
$('form[id=xyz]')
$('form[class=blah]')
$('form#xyz')

Is there a specific question here?

On Mon, Nov 9, 2009 at 2:33 PM, Lord Gustavo Miguel Angel 
goosfanc...@gmail.com wrote:

  then...
 what alternative have?
 thank´s

  *From:* Charlie Griefer charlie.grie...@gmail.com
 *Sent:* Monday, November 09, 2009 7:18 PM
 *To:* jquery-en@googlegroups.com
 *Subject:* Re: [jQuery] jquery form and myfom

 On Mon, Nov 9, 2009 at 2:16 PM, Lord Gustavo Miguel Angel 
 goosfanc...@gmail.com wrote:

 hi,
 jquery form only work if name of form is myform? is correct afirmation?


 there are no such restrictions/limitations.

 Any page element can have any valid name value (any valid value for any
 attribute, actually).

 --
 Charlie Griefer
 http://charlie.griefer.com/

 I have failed as much as I have succeeded. But I love my life. I love my
 wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] jquery form and myfom

2009-11-09 Thread Charlie Griefer
I want that 10 minutes of my life back... :\

On Mon, Nov 9, 2009 at 2:47 PM, Lord Gustavo Miguel Angel 
goosfanc...@gmail.com wrote:

  ok.
 thnks´ i treid it.


  *From:* Charlie Griefer charlie.grie...@gmail.com
 *Sent:* Monday, November 09, 2009 7:41 PM
 *To:* jquery-en@googlegroups.com
 *Subject:* Re: [jQuery] jquery form and myfom

 name your elements with whatever name you want.

 form name=gustavo id=xyz class=blah

 can be selected via:

 $('#xyz')
 $('.blah') (this will return an array of -all- elements of class blah)
 $('form') (this will return an array of -all- form elements on the pag)
 $('form[name=gustavo]')
 $('form[id=xyz]')
 $('form[class=blah]')
 $('form#xyz')

 Is there a specific question here?

 On Mon, Nov 9, 2009 at 2:33 PM, Lord Gustavo Miguel Angel 
 goosfanc...@gmail.com wrote:

  then...
 what alternative have?
 thank´s

  *From:* Charlie Griefer charlie.grie...@gmail.com
 *Sent:* Monday, November 09, 2009 7:18 PM
 *To:* jquery-en@googlegroups.com
 *Subject:* Re: [jQuery] jquery form and myfom

 On Mon, Nov 9, 2009 at 2:16 PM, Lord Gustavo Miguel Angel 
 goosfanc...@gmail.com wrote:

 hi,
 jquery form only work if name of form is myform? is correct afirmation?


 there are no such restrictions/limitations.

 Any page element can have any valid name value (any valid value for any
 attribute, actually).

 --
 Charlie Griefer
 http://charlie.griefer.com/

 I have failed as much as I have succeeded. But I love my life. I love my
 wife. And I wish you my kind of success.




 --
 Charlie Griefer
 http://charlie.griefer.com/

 I have failed as much as I have succeeded. But I love my life. I love my
 wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Div change

2009-11-09 Thread Charlie Griefer
On Mon, Nov 9, 2009 at 3:26 PM, factoringcompare.com 
firstfacto...@googlemail.com wrote:

 When div id=MyResult/div changes with a AJAX response I would
 like to fire a alert. What am I doing wrong?

 $(document).ready(function() {

  $(#MyResult).change(function (){
alert('hi');
  });

  });



I think the change event only applies to select and input elements.

Most AJAX methods let you specify some sort of callback function to
execute.  See http://docs.jquery.com/Ajax/ajaxComplete#callback or
http://docs.jquery.com/Ajax/load#urldatacallback or
http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback or (well, you get
the point).

Point being... you should be able to fire your alert as part of the callback
function :)


-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Re: How to keep two select items having the same value

2009-11-09 Thread Charlie Griefer
On Mon, Nov 9, 2009 at 4:06 PM, Dave Methvin dave.meth...@gmail.com wrote:


  What I want is: When the user choose an item from the number1
  select, the number2select will automatically change to the same
  value to the number2.

 Maybe something like this?

 $(select[name=number1]).change(function(){
  $(select[name=number2]).val(
 $(this).val()
   );
 });

 If the change event doesn't do it for you, take a look at .click()
 or .blur().


change() oughtta do it.  What you have there should work perfectly.

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Characters in a string

2009-11-08 Thread Charlie Griefer
On Sun, Nov 8, 2009 at 10:53 AM, Dave Maharaj :: WidePixels.com 
d...@widepixels.com wrote:

  I have a string where i need to get the last specific number of
 characters but cant seem to find an answer when you don't know the length of
 the strings since its dynamic.

 var str=/folder/subfolder/setfolder/6ab0e34e915;

 where i need the last 11 digits (6ab0e34e915). The folder names change so
 that number is never know to subtrct back from leaving me with 11


straight JS.

var str = /folder/subfolder/setfolder/6ab0e34e915;
var arr = str.split('/');  // converts your string to an array, delimited by
the '/' character

var myNumber = arr[arr.length-1];

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Append Help

2009-11-04 Thread Charlie Griefer
shot in the dark here... but prependTo()?

On Wed, Nov 4, 2009 at 9:01 AM, Dave Maharaj :: WidePixels.com 
d...@widepixels.com wrote:

  I am uploading images and once uploaded they appear in my sortable list.

 I have
 success response:

 $('li/li').appendTo('#sortable').fadeIn('slow').html(response);

 page code:
 ul id=sortable class=files
 liimage1/li - are there when the page loads
 liimage2/li - are there when the page loads
 liimage3/li - are there when the page loads

 liimage4/li - newly added image appears here but I would like it to
 appear above image1
 /ul

 But I would like to have it appear at the top. What I have adds it to the
 very bottom of the list. How can I have it appear at the top of the list?

 Thanks

 Dave




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Append Help Issue

2009-11-04 Thread Charlie Griefer
Try prepend() instead of prependTo()?

http://docs.jquery.com/Manipulation/prepend

On Wed, Nov 4, 2009 at 9:40 AM, Dave Maharaj :: WidePixels.com 
d...@widepixels.com wrote:

  Ok i changed the code to:

 $('li/li').prependTo('#sortable').fadeIn('slow').html(response);

 My response is already in a li which has variables from the php script so
 I need it returned in the response.

 So I end up with being added to the sortable list (extra li set i dont
 need)
 li
 li id =my_idcode.
 /li
 /li

 How can I just insert the response to the #sortable at the top?

 Thanks again,

 Dave

  --
 *From:* Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com]
 *Sent:* November-04-09 1:40 PM
 *To:* jquery-en@googlegroups.com
 *Subject:* RE: [jQuery] Append Help

  That certainly was fast.

 Thanks, just what i needed.

 Dave

  --
 *From:* Charlie Griefer [mailto:charlie.grie...@gmail.com]
 *Sent:* November-04-09 1:35 PM
 *To:* jquery-en@googlegroups.com
 *Subject:* Re: [jQuery] Append Help

 shot in the dark here... but prependTo()?

 On Wed, Nov 4, 2009 at 9:01 AM, Dave Maharaj :: WidePixels.com 
 d...@widepixels.com wrote:

  I am uploading images and once uploaded they appear in my sortable list.

 I have
 success response:

 $('li/li').appendTo('#sortable').fadeIn('slow').html(response);

 page code:
 ul id=sortable class=files
 liimage1/li - are there when the page loads
 liimage2/li - are there when the page loads
 liimage3/li - are there when the page loads

 liimage4/li - newly added image appears here but I would like it to
 appear above image1
 /ul

 But I would like to have it appear at the top. What I have adds it to the
 very bottom of the list. How can I have it appear at the top of the list?

 Thanks

 Dave




 --
 Charlie Griefer
 http://charlie.griefer.com/

 I have failed as much as I have succeeded. But I love my life. I love my
 wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] i can't use HTML ID's appended dynamically

2009-11-02 Thread Charlie Griefer
On Mon, Nov 2, 2009 at 12:00 AM, Aymen louati mail.ay...@gmail.com wrote:

 Hi Guys i'm having a serious problem :
 i'm using a JSON File to bring data and append it into HTML element so
 i can get few divs and a link a i automatically  generate the a
 ID's then i select each ID and call a jdialog plugin so i can display
 a dialog window
 the problem is that the jdialog is not working based on generated ID's
 but it works when ever i name it statically
 i tried to change the position of the script puting in down the page
 but still got nothing and yes i got this problem so many times i feel
 like i'm having a missing part out the jquery puzzle  any information
 would be so helpful and appreciated thank you this is a part of the
 code


See the jQuery live() method:

http://docs.jquery.com/Events/live

*Added in jQuery 1.3:* Binds a handler to an event (like click) for all
current - and future - matched element. Can also bind custom events.

Note the and future.  Out of the box, jQuery events won't be bound to
elements that were added to the DOM after the page has loaded.  To do this,
you need to use live().

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery]

2009-10-31 Thread Charlie Griefer
On Sat, Oct 31, 2009 at 8:43 AM, hno hno2...@gmail.com wrote:

  Hi

 I’m novice in jquety. I want to retrieve different properties like src ,
 height and other from the elements in the page or set the value for them .
 can you help me to do this work


Have you read the docs?  http://docs.jquery.com

Is there a specific piece that you're having trouble with?  What have you
tried so far and what obstacles are you encountering?

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


Re: [jQuery] Preventing form submit

2009-10-29 Thread Charlie Griefer
On Thu, Oct 29, 2009 at 9:21 AM, SamCKayak s...@elearningcorner.com wrote:

 I've added a jQuery .onClick to a form submit.

 Is there a way to prevent the form from submitting?



return false in the click handler.

$('#myFormSubmit').click(function() {
 do stuff;
 return false;
});

Altho, I'm wondering if it'd be better handled (understanding that better
is subjective) to use the form's submit method rather than the submit
button's click method.

e.g.:

$('#myFormID').submit(function() {
 do stuff;
 return false;
}

I can't elaborate on why, other than I've been told way back in the day that
it's better to not use an onclick on a submit button, but rather the
onsubmit on the form itself.

Maybe somebody on the list can elaborate on that... but either way should
give you the results that you're looking for.

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: JQuery cloned elements new class isn't recognized.

2009-10-21 Thread Charlie Griefer
http://docs.jquery.com/Events/live

elements added after the initial DOM load will not be recognized by jQuery
unless the afore-referenced live() method is used.

On Wed, Oct 21, 2009 at 12:40 PM, Ali alisem...@gmail.com wrote:


 Hey. I have two functions show after the message. The first works
 fine. When a checkbox is clicked with the class availableProfile, its
 class is removed, selectedProfile added. It is then appended to
 anotehr list and destroyed in the original. However when i click the
 now moved checkbox it doesn't recognize it has the new class of
 selectedProfile.

$(.availableProfile).click(function(event) {
elementID = event.target.id;
elementGroup = elementID.split(__);
$(this).removeClass(availableProfile);
$(this).addClass(selectedProfile);
$(this).parent().clone(true).appendTo(# +
 elementGroup[0] +
 _selected);
$(this).parent().remove();
});


  $(.selectedProfile).click(function(event) {

elementID = event.target.id;
elementGroup = elementID.split(__);
$(this).removeClass(selectedProfile);
$(this).addClass(availableProfile);
$(this).parent().clone(true).appendTo(# +
 elementGroup[0] +
 _available);
$(this).parent().remove();

});




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread Charlie Griefer
On Mon, Oct 19, 2009 at 7:28 PM, ReynierPM rper...@uci.cu wrote:


 Isn't working.

 HTML Code:
 label for=same class=firstSame input type=checkbox name=same
 id=same onclick=doCopy //label

 label for=first_name class=firstFirst Name: input type=text
 name=first_name id=first_name value= size= //label
 label for=first_name1Middle Name: input type=text name=first_name1
 id=first_name1 value= size= //label

 JS Code:
 function doCopy(){
  $(first_name1).val($(first_name).val())
 }
 Where is the error?



Your selectors are incorrect.  $('first_name1') looks for a first_name
element in the DOM (there is none).  You're referencing by ID, so you want
to preface the ID with a # sign (similar to CSS).

$('#first_name1').val($('#first_name').val())

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Color based on table data

2009-10-13 Thread Charlie Griefer
does this help?

http://charlie.griefer.com/blog/index.cfm/2009/8/18/jQuery--Manipulating-Table-Row-Background-Colors

(there are 3 parts to the series... links to parts 2 and 3 at the bottom
of the entry)

On Tue, Oct 13, 2009 at 10:31 AM, Chris caw1...@gmail.com wrote:


 I have a table of data brought in through lift and in it is a status
 column.  I am wondering if there is an easy way to color a row based
 on the contents of that column. Any status of broken was red, edited
 was yellow and finalized was green.  It seems like I could write a
 widget for doing this, but I don't know how it would work and have
 little experience with creating my own widgets.I don't think linking
 any of my code would really help the cause, but here is the
 initialization which includes functions for mouseover color changes.

  script type=text/javascript
$(document).ready(function() {

//  Adds over class to rows on mouseover
$(.tablesorter tr).mouseover(function(){
$(this).addClass(rowHover);
});

//  Removes over class from rows on mouseout
$(.tablesorter tr).mouseout(function(){
$(this).removeClass(rowHover);
});

$('.tablesorter selectThisRow').click(function() {
$(this).parent('tr').addClass('selected');

});


$(#claims).tablesorter(
{

sortList:[[4,0],[6,0]],
widgets: ['zebra'],
headers: {
0: {  sorter: false },
1: {  sorter: false },
2: {  sorter: false },
3: {  sorter: false },
5: {  sorter: false },
7: {  sorter: false },
8: {  sorter: false }
}
})
.tablesorterPager({container: $(#pager)});
  });
  /script

 I'm working with scala and lift as well so I'm bringing in the table
 data from a database when the page loads.

 Any advice would be helpful here, whether you think a widget is how to
 make the colors adjust, or creating more JS functions for doing it.

 Thanks in advance,

 Chris




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Please explain $(#username) $(#newUser).bind(click,{},function(){}) and..........

2009-10-10 Thread Charlie Griefer
On Fri, Oct 9, 2009 at 10:18 PM, anjith anjithkumar.garap...@gmail.comwrote:


  i am using Jquery and javascript from long back but i don't know what
 this really means and what they return etc can any explain theseor
 can u just any wesite containing tutorials about these codings.


Everything you need is in the docs.  http://docs.jquery.com

Specific to your question:

http://docs.jquery.com/Selectors
http://docs.jquery.com/Events/bind

$('#username') references the element with id=username
$('#newUser').bind('click', ... ) binds a specific function to the click
event of the element with id=newUser

The docs really should be the first place you look for questions like this.

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Please say the meaning of $(#username) or $(#newUser).bind(click,{},function(){}) and..........

2009-10-10 Thread Charlie Griefer
On Fri, Oct 9, 2009 at 10:30 PM, anjith anjithkumar.garap...@gmail.comwrote:


 i am using Jquery and javascript from long back but i don't know what
 this really means and what they return etc can any explain theseor
 can u just any wesite containing tutorials about these codings.


  $(#username)

  $(#newUser).bind(click,{},function(){})


 $(#spamimage).attr({src:})

 I know what functions they do but i am unable to write my own
 programing using these , the third command i know it is returning src
 for a image but what is syntax and how to call value in a div or p tag
 and how to return values in to those tags using these type of coding
 can u say any books/websites or any e-material also helpful to me...
 Generally we use document.getElementById().value or
 document.getElementByName().value


See my previous response for the answers to the first two, including
websites.  Search Amazon for jQuery and you'll see a few books.  Make sure
the books are for jQuery 1.3 (the latest version).

The second isn't returning the src for an image.  it's setting the src
attribute to be an empty string on the image with id=spamimage.

$('#foo') is jQuery notation for document.getElementById('foo').  Much more
concise.

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Select all class not keyword_type_A, please help

2009-10-09 Thread Charlie Griefer
First off, I'd add a ul around those li elements.

If you do that, and give it an id attribute of 'myList', you can do the
following:

// hide all list items
$('#myList li').hide();
// show only class keyword_type_S
$('.#myList .keyword_type_S').show();

You can certainly do the same thing without the ul, but it's not
semantically correct, and it'll be a little more efficient to search within
a ul with a specified id than to search the entire document for a specific
class name.

On Fri, Oct 9, 2009 at 1:49 AM, Tan it_qn2...@yahoo.com wrote:


 Hello.
 I have a list:
 a href=# id=AA/a
 div id=TB_ajaxContent
 /div
 li class=keyword_type_Ctag
 /li
 li class=keyword_type_Ttag
 /li
 li class=keyword_type_Ptag
 /li
 li class=keyword_type_Ltag
 /li
 li class=keyword_type_Ktag
 /li
 li class=keyword_type_Stag
 /li
 li class=keyword_type_Stag
 /li
 li class=keyword_type_Htag
 /li
 li class=keyword_type_Ttag
 /li
 li class=keyword_type_Ttag
 /li
 li class=keyword_type_Ttag
 /li
 li class=keyword_type_Atag
 /li
 li class=keyword_type_Ctag
 /li
 li class=keyword_type_Stag
 /li
 li class=keyword_type_Ktag
 /li
 li class=keyword_type_Gtag
 /li
 li class=keyword_type_Etag
 /li
 li class=keyword_type_Qtag
 /li
 li class=keyword_type_Rtag
 /li
 li class=keyword_type_Ttag
 /li
 li class=keyword_type_Btag
 /li
 li class=keyword_type_Stag
 /li
 li class=keyword_type_Ttag
 /li
 /div
 I create a code jquery show only class=keyword_type_S
 $(document).ready(function() {
 $('#A').click(function() {
   $('.keyword_type_A').show();
  $('^li.keyword_type_A').hide();

  // $('div:not('.keyword_type_A')').hide();

  });
 });
 but it's not work. Please help.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Hide row if empty

2009-10-08 Thread Charlie Griefer
On Thu, Oct 8, 2009 at 5:10 PM, Wacko Jacko jackson.be...@gmail.com wrote:


 Hi There. Yeah, just did. Thanks for that!

 Why does my test using the same code not work :(

 http://www.noosabiosphere.org.au/tester.htm


Viewing the source, that div isn't empty.  it's got whitespace characters
(spaces and/or tabs and/or newlines)

There should be a few ways you can fix that.  If you're generating this
content dynamically, you should be able to trim the data on the server
side.  If not, you can trim it out on the client via a JS regex or
jQuery.trim().

if (jQuery.trim($answer.text()) == '')

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Downloading Jquery

2009-10-01 Thread Charlie Griefer
On Thu, Oct 1, 2009 at 9:41 AM, tendai financialsa...@gmail.com wrote:


 Im creating a photo gallery that uses jquery. After downloading jquery
 it wont let me run it. Anybody know whats up with that.



You're really going to have to elaborate if you expect any helpful answers
(other than this one) :)

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: jQuery plugin that can do the image effects here?

2009-09-30 Thread Charlie Griefer
Hi Michael:

Would this do?

http://www.gruppo4.com/~tobia/cross-slide.shtml

On Wed, Sep 30, 2009 at 5:48 AM, Michael Price
m...@edwardrobertson.co.ukwrote:

  ‘lo all,

 Boss has been asking me if we can replicate the image fader here:

 http://www.gleneagles.com/home.aspx



 Note how it pans and slides as well as fading between images – this one is
 done in Flash. We often use the Cycle plugin for a fade-between set of
 images but is there a plugin to do something like the above, or can the
 Cycle plugin be made to do it?



 Regards,

 Michael Price




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: How to link the JQuery

2009-09-30 Thread Charlie Griefer
in your main page...

you link to jquery.js:

script type=text/javascript src=/my/path/to/jquery.js/script

Then you can either write inline javascript under that...

script type=text/javascript
 $(document).ready(function() {
  alert(I am ready);
 });
/script

... or you simply link to other external scripts:

script type=text/javascript src=/my/path/to/myExternalJS.js/script

...as many times as you need to.

script type=text/javascript
src=/my/path/to/myOtherExternalJS.js/script

There's no functional difference between using an external .js file or
putting your JS in the page itself.  Arguably, it's easier to maintain if
it's well-organized in included files... but functionally no different.
Well, there's the advantage of the .js file being cached in the browser in
subsequent page requests... but other than that, functionally no different
:)

Understand that doing script src=/my/path/to/js.js/script is
essentially including the .js on that page.

The only thing to bear in mind is that the files will load in the order
they're specified.  So make sure your include to the jQuery file is first.



On Wed, Sep 30, 2009 at 6:46 PM, Glen_H glen.f.he...@gmail.com wrote:


 I am confused as to how to link an external JQuery file to my web
 page. I understand using script src=/. My question is regarding
 the file I downloaded from Jquery.com. Do I add code to that file and
 link it, or do I link that file and then create a new file with
 javascript in it and link that as well?

 Do I create a javascript file and somehow link the Jquery file to that
 javascript file?


 I guess I would need a step by step walkthrough on how to set up
 Jquery using all external files.


 thanks in advance guys




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: How to link the JQuery

2009-09-30 Thread Charlie Griefer
As with including an external .js file, including an external .css file is
not functionally different than including it on the page.  The included css
will affect any applicable element(s) on the page.

When you manipulate an element's CSS with jQuery, you're just manipulating
the CSS of that specific element.

In short, no.  There's nothing special you need to do.  jQuery doesn't
technically access or touch the .css file.  It applies a particular style to
an element.  Whether that element knows that style depends on whether or
not the style is defined (either inline via style type=text/css or via a
linked .css file).

On Wed, Sep 30, 2009 at 7:59 PM, Glen_H glen.f.he...@gmail.com wrote:


 Charlie, thanks for the feedback. A million times thank you! that is
 exactly what I was looking for.

 One other question I have is altering CSS using .css in Jquery, will
 that auto select any linked css files or will I have to further
 develop the jquery code to further direct it? I ask becuse well, im
 new, but the tutorial I used just used .css and acted like that was
 all that was needed.

 again, thanks for your help Charlie!

 On Sep 30, 10:48 pm, Charlie Griefer charlie.grie...@gmail.com
 wrote:
  in your main page...
 
  you link to jquery.js:
 
  script type=text/javascript src=/my/path/to/jquery.js/script
 
  Then you can either write inline javascript under that...
 
  script type=text/javascript
   $(document).ready(function() {
alert(I am ready);
   });
  /script
 
  ... or you simply link to other external scripts:
 
  script type=text/javascript
 src=/my/path/to/myExternalJS.js/script
 
  ...as many times as you need to.
 
  script type=text/javascript
  src=/my/path/to/myOtherExternalJS.js/script
 
  There's no functional difference between using an external .js file or
  putting your JS in the page itself.  Arguably, it's easier to maintain if
  it's well-organized in included files... but functionally no different.
  Well, there's the advantage of the .js file being cached in the browser
 in
  subsequent page requests... but other than that, functionally no
 different
  :)
 
  Understand that doing script src=/my/path/to/js.js/script is
  essentially including the .js on that page.
 
  The only thing to bear in mind is that the files will load in the order
  they're specified.  So make sure your include to the jQuery file is
 first.
 
 
 
  On Wed, Sep 30, 2009 at 6:46 PM, Glen_H glen.f.he...@gmail.com wrote:
 
   I am confused as to how to link an external JQuery file to my web
   page. I understand using script src=/. My question is regarding
   the file I downloaded from Jquery.com. Do I add code to that file and
   link it, or do I link that file and then create a new file with
   javascript in it and link that as well?
 
   Do I create a javascript file and somehow link the Jquery file to that
   javascript file?
 
   I guess I would need a step by step walkthrough on how to set up
   Jquery using all external files.
 
   thanks in advance guys
 
  --
  Charlie Grieferhttp://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: How to link the JQuery

2009-09-30 Thread Charlie Griefer
No worries.  Send me a NJ pizza.  I haven't had good pizza since I left NJ
:)

On Wed, Sep 30, 2009 at 8:13 PM, Glen_H glen.f.he...@gmail.com wrote:


 Thanks again!

 Thanks from Central jersey too! I saw on your site your home grown
 Jersey, Good stuff.


 Take it easy man.

 Glen

 On Sep 30, 11:05 pm, Charlie Griefer charlie.grie...@gmail.com
 wrote:
  As with including an external .js file, including an external .css file
 is
  not functionally different than including it on the page.  The included
 css
  will affect any applicable element(s) on the page.
 
  When you manipulate an element's CSS with jQuery, you're just
 manipulating
  the CSS of that specific element.
 
  In short, no.  There's nothing special you need to do.  jQuery doesn't
  technically access or touch the .css file.  It applies a particular style
 to
  an element.  Whether that element knows that style depends on whether
 or
  not the style is defined (either inline via style type=text/css or
 via a
  linked .css file).
 
 
 
  On Wed, Sep 30, 2009 at 7:59 PM, Glen_H glen.f.he...@gmail.com wrote:
 
   Charlie, thanks for the feedback. A million times thank you! that is
   exactly what I was looking for.
 
   One other question I have is altering CSS using .css in Jquery, will
   that auto select any linked css files or will I have to further
   develop the jquery code to further direct it? I ask becuse well, im
   new, but the tutorial I used just used .css and acted like that was
   all that was needed.
 
   again, thanks for your help Charlie!
 
   On Sep 30, 10:48 pm, Charlie Griefer charlie.grie...@gmail.com
   wrote:
in your main page...
 
you link to jquery.js:
 
script type=text/javascript src=/my/path/to/jquery.js/script
 
Then you can either write inline javascript under that...
 
script type=text/javascript
 $(document).ready(function() {
  alert(I am ready);
 });
/script
 
... or you simply link to other external scripts:
 
script type=text/javascript
   src=/my/path/to/myExternalJS.js/script
 
...as many times as you need to.
 
script type=text/javascript
src=/my/path/to/myOtherExternalJS.js/script
 
There's no functional difference between using an external .js file
 or
putting your JS in the page itself.  Arguably, it's easier to
 maintain if
it's well-organized in included files... but functionally no
 different.
Well, there's the advantage of the .js file being cached in the
 browser
   in
subsequent page requests... but other than that, functionally no
   different
:)
 
Understand that doing script src=/my/path/to/js.js/script is
essentially including the .js on that page.
 
The only thing to bear in mind is that the files will load in the
 order
they're specified.  So make sure your include to the jQuery file is
   first.
 
On Wed, Sep 30, 2009 at 6:46 PM, Glen_H glen.f.he...@gmail.com
 wrote:
 
 I am confused as to how to link an external JQuery file to my web
 page. I understand using script src=/. My question is regarding
 the file I downloaded from Jquery.com. Do I add code to that file
 and
 link it, or do I link that file and then create a new file with
 javascript in it and link that as well?
 
 Do I create a javascript file and somehow link the Jquery file to
 that
 javascript file?
 
 I guess I would need a step by step walkthrough on how to set up
 Jquery using all external files.
 
 thanks in advance guys
 
--
Charlie Grieferhttp://charlie.griefer.com/
 
I have failed as much as I have succeeded. But I love my life. I love
 my
wife. And I wish you my kind of success.
 
  --
  Charlie Grieferhttp://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Hide row if empty

2009-09-30 Thread Charlie Griefer
If you're working with server side data like that, couldn't you just write a
conditional in whatever language you're using (PHP, CF, ASP, etc) to not
display the li if no data?

Also, do you really mean to re-use database as an ID for multiple
elements?  ID's ought to be unique.

On Wed, Sep 30, 2009 at 9:43 PM, Wacko Jacko jackson.be...@gmail.comwrote:


 Hi All,

 If I had a list displaying data as follows:

 ul
 li id=itemdivLabel Here/divdiv id=database{content
 here if available from database}/div/li
 li id=itemdivLabel Here/divdiv id=database{content
 here if available from database}/div/li
 /ul

 Could I hide the whole li id=item/li if their is nothing
 available to show from the database in div id=database ?

 Thanks in advance for your help

 Jack




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Hide row if empty

2009-09-30 Thread Charlie Griefer
Assuming you can turn those id's into classes (where you have
id=database)... you can do the following:

$(document).ready(function(){
$('ul .database').each(function() {
if ($(this).text() == ) {
$(this).parent().hide();
}
});
});

On Wed, Sep 30, 2009 at 10:14 PM, Charlie Griefer charlie.grie...@gmail.com
 wrote:

 If you're working with server side data like that, couldn't you just write
 a conditional in whatever language you're using (PHP, CF, ASP, etc) to not
 display the li if no data?

 Also, do you really mean to re-use database as an ID for multiple
 elements?  ID's ought to be unique.


 On Wed, Sep 30, 2009 at 9:43 PM, Wacko Jacko jackson.be...@gmail.comwrote:


 Hi All,

 If I had a list displaying data as follows:

 ul
 li id=itemdivLabel Here/divdiv id=database{content
 here if available from database}/div/li
 li id=itemdivLabel Here/divdiv id=database{content
 here if available from database}/div/li
 /ul

 Could I hide the whole li id=item/li if their is nothing
 available to show from the database in div id=database ?

 Thanks in advance for your help

 Jack




 --
 Charlie Griefer
 http://charlie.griefer.com/

 I have failed as much as I have succeeded. But I love my life. I love my
 wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Checking/unchecking parent checkbox

2009-09-29 Thread Charlie Griefer
try:

$(this).siblings('input[type=checkbox]').attr('checked','');
$(this).siblings('input[type=checkbox]').attr('checked','checked');

On Tue, Sep 29, 2009 at 6:09 AM, evanbu...@gmail.com evanbu...@gmail.comwrote:


 Anyone?  I've been working on this for hours and can't come up with a
 solution.  Thanks

 On Sep 28, 3:13 pm, evanbu...@gmail.com evanbu...@gmail.com wrote:
  I thought this would do it but no luck
 
  $(this).parents(checkbox:first).attr('checked', false);
 
  On Sep 28, 2:42 pm, evanbu...@gmail.com evanbu...@gmail.com wrote:
 
 
 
   Hi
 
   I've been using jQuery a couple of months and I'm really having a
   blast with it but need a little help with this problem.
 
   I have a table of records generated from a database that looks like
   this. Each record has a checkbox with a unique id followed by a
   person's name and employment status.
 
   trtd
 input type=checkbox id=rptDirectors_ctl19_chkDirectorName
   class=chkDirector checked=checked value=25094 /
 span id=rptDirectors_ctl19_lblDirFNameJ. Pedro/span  span
   id=rptDirectors_ctl19_lblDirLNameReinhard/span (span
   id=rptDirectors_ctl19_lblRelStatus class=RelStatusRetired/span)
   /td/tr
 
   trtd
 input type=checkbox id=rptDirectors_ctl23_chkDirectorName
   class=chkDirector checked=checked value=29632 /
 span id=rptDirectors_ctl23_lblDirFNameJames B./span  span
   id=rptDirectors_ctl23_lblDirLNameWilliams/span (span
   id=rptDirectors_ctl23_lblRelStatus class=RelStatusActive/
   span)
   /td/tr
 
   When this checkbox (chkIncludeRetired) is checked/unchecked, the
   person's employment status (RelStatus) is checked and the entire row
   is hidden/shown. My jquery code below does this perfectly with no
   problems.  However, in addition to hiding/showing the row. However, I
   also need the parent checkbox to be checked or unchecked. So if
   RelStatus == Retired then it's parent checkbox also needs to be
   unchecked else then it's parent checkbox needs to be checked.
 
   input id=chkIncludeRetired type=checkbox /i Exclude Retired
   Directors and Executives/i
 
   script language=javascript type=text/javascript
   $(document).ready(function() {
 $('#chkIncludeRetired').click(
 function() {
 $('.RelStatus').each(function() {
if ($(#chkIncludeRetired).is(:checked))
   {
   if ($(this).text() == Retired)
   $(this).parent().css('display',
   'none');
   }
   else
   {
   $(this).parent().css('display',
   'block');
   }
   });
   });});
 
   /script
 
   Thank you very much.- Hide quoted text -
 
  - Show quoted text -




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Using variables in an Attribute filter

2009-09-29 Thread Charlie Griefer
$('p[id=' + myClr + ']').addClass('bold');

you need to concatenate the variable in with the literal text so it can be
evaluated.

On Tue, Sep 29, 2009 at 10:59 AM, roi roi.agn...@gmail.com wrote:


 I am trying to do something that seems very simple, but can not get to
 work!  Basically, I want to find an element whose ID equals a certain
 value, as represented by a variable.  The variable is derived from a
 dropdown list.  Here is my code:

 $(document).ready(function(){
 $(select).change(function() {
 var myClr = $(select).val();

 $(p[id=myClr]).addClass(bold); //this is the line giving me
 trouble
 });
 });

 I am wondering if it is legal to use a variable within the filter - if
 I replace it with an actual ID value it works fine, but when I
 substitute the variable name nothing happens.

 I am sure I am doing something dumb!  Thanks for any suggestions.

 Roi




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread Charlie Griefer
$('#test').blur(function() {
$(this).val($(this).val().replace(/,/g,''));
});

You call it by telling jQuery to listen for the blur() event on the
element with id=test (line 1 above).

Your code was correct, but you can replace the $('input#test') with $(this),
since $(this) will be a reference to the element that triggered the blur.

On Tue, Sep 29, 2009 at 12:04 PM, factoringcompare.com 
firstfacto...@googlemail.com wrote:


 Hi,

 New to jQuery.

 I would like to strip out all of the commas in numeric text field
 called test on blur. New to jQuery. I have had a go at coding would it
 work?


 $('input#test').val($('input#test').val().replace(/,/g,''));


 and ... how do i calll it?




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread Charlie Griefer
jQuery is based on find something - do something.  The find something
is largely done with selectors (similar to CSS selectors).

you want to find the element with the id=test.  that would be $('#test')

you want it to do something when that element receives a blur event...

$('#test').blur(); -- that's the event, but it's not doing anything yet.
To do something, pass a function to the blur():

$('#test').blur(function() { });

which, when fleshed out a little more, might look like:

$('#test').blur(function() {
 alert('I just got blurred!');
});

While inside these inner functions, you have a handle on the element that
triggered it.  It's referred to as $(this).  You can also use plain ol'
javascript and use 'this' (no quotes).  Depends on what you're doing with
it.

$('#test').blur(function() {
 alert(this.id);
 alert($(this).attr('id'));  // they do the same thing
});

Most of this (if not all of it) is covered in the docs.

http://docs.jquery.com/ and http://docs.jquery.com/How_jQuery_Works

On Tue, Sep 29, 2009 at 1:04 PM, factoringcompare.com 
firstfacto...@googlemail.com wrote:


 Thank you. Could you elaborate on the code so that I can track it
 through and understand

 On Sep 29, 8:49 pm, Charlie Griefer charlie.grie...@gmail.com wrote:
  $('#test').blur(function() {
  $(this).val($(this).val().replace(/,/g,''));
 
  });
 
  You call it by telling jQuery to listen for the blur() event on the
  element with id=test (line 1 above).
 
  Your code was correct, but you can replace the $('input#test') with
 $(this),
  since $(this) will be a reference to the element that triggered the blur.
 
  On Tue, Sep 29, 2009 at 12:04 PM, factoringcompare.com 
 
  firstfacto...@googlemail.com wrote:
 
   Hi,
 
   New to jQuery.
 
   I would like to strip out all of the commas in numeric text field
   called test on blur. New to jQuery. I have had a go at coding would it
   work?
 
   $('input#test').val($('input#test').val().replace(/,/g,''));
 
   and ... how do i calll it?
 
  --
  Charlie Grieferhttp://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread Charlie Griefer
Because it's completely new to you is exactly why you should be reading the
docs :)

Does the code below run?

On Tue, Sep 29, 2009 at 1:27 PM, factoringcompare.com 
firstfacto...@googlemail.com wrote:


 Thank you. JQuery is completly new to me. OK how des the belo code
 look?


 script
  $(document).ready(function(){

$(#test').blur(function () {
 $('#test').val($('#test').val().replace(/,/g,''));
});

  });
  /script


 On Sep 29, 9:17 pm, Charlie Griefer charlie.grie...@gmail.com wrote:
  jQuery is based on find something - do something.  The find
 something
  is largely done with selectors (similar to CSS selectors).
 
  you want to find the element with the id=test.  that would be
 $('#test')
 
  you want it to do something when that element receives a blur event...
 
  $('#test').blur(); -- that's the event, but it's not doing anything yet.
  To do something, pass a function to the blur():
 
  $('#test').blur(function() { });
 
  which, when fleshed out a little more, might look like:
 
  $('#test').blur(function() {
   alert('I just got blurred!');
 
  });
 
  While inside these inner functions, you have a handle on the element
 that
  triggered it.  It's referred to as $(this).  You can also use plain ol'
  javascript and use 'this' (no quotes).  Depends on what you're doing
 with
  it.
 
  $('#test').blur(function() {
   alert(this.id);
   alert($(this).attr('id'));  // they do the same thing
 
  });
 
  Most of this (if not all of it) is covered in the docs.
 
  http://docs.jquery.com/andhttp://docs.jquery.com/How_jQuery_Works
 
  On Tue, Sep 29, 2009 at 1:04 PM, factoringcompare.com 
 
 
 
 
 
  firstfacto...@googlemail.com wrote:
 
   Thank you. Could you elaborate on the code so that I can track it
   through and understand
 
   On Sep 29, 8:49 pm, Charlie Griefer charlie.grie...@gmail.com wrote:
$('#test').blur(function() {
$(this).val($(this).val().replace(/,/g,''));
 
});
 
You call it by telling jQuery to listen for the blur() event on
 the
element with id=test (line 1 above).
 
Your code was correct, but you can replace the $('input#test') with
   $(this),
since $(this) will be a reference to the element that triggered the
 blur.
 
On Tue, Sep 29, 2009 at 12:04 PM, factoringcompare.com 
 
firstfacto...@googlemail.com wrote:
 
 Hi,
 
 New to jQuery.
 
 I would like to strip out all of the commas in numeric text field
 called test on blur. New to jQuery. I have had a go at coding would
 it
 work?
 
 $('input#test').val($('input#test').val().replace(/,/g,''));
 
 and ... how do i calll it?
 
--
Charlie Grieferhttp://charlie.griefer.com/
 
I have failed as much as I have succeeded. But I love my life. I love
 my
wife. And I wish you my kind of success.
 
  --
  Charlie Grieferhttp://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.- Hide quoted text -
 
  - Show quoted text -




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread Charlie Griefer
Works for me.

Bear in mind you're selecting every input on the page by virtue of
$('input').

Bear in mind further that on blur for every input, you're telling jquery to
remove the commas from the element with id=test (by virtue of $('#test').

Do you have an element with id=test ?

On Tue, Sep 29, 2009 at 1:53 PM, factoringcompare.com 
firstfacto...@googlemail.com wrote:


 No it doesn’t work. I’ll work it out.

 script
  $(document).ready(function(){

$(input).blur(function () {
 $('#test').val($('#test').val().replace(/,/g,''));
});

  });
  /script


 On Sep 29, 9:42 pm, Charlie Griefer charlie.grie...@gmail.com wrote:
  Because it's completely new to you is exactly why you should be reading
 the
  docs :)
 
  Does the code below run?
 
  On Tue, Sep 29, 2009 at 1:27 PM, factoringcompare.com 
 
 
 
 
 
  firstfacto...@googlemail.com wrote:
 
   Thank you. JQuery is completly new to me. OK how des the belo code
   look?
 
   script
$(document).ready(function(){
 
  $(#test').blur(function () {
   $('#test').val($('#test').val().replace(/,/g,''));
  });
 
});
/script
 
   On Sep 29, 9:17 pm, Charlie Griefer charlie.grie...@gmail.com wrote:
jQuery is based on find something - do something.  The find
   something
is largely done with selectors (similar to CSS selectors).
 
you want to find the element with the id=test.  that would be
   $('#test')
 
you want it to do something when that element receives a blur
 event...
 
$('#test').blur(); -- that's the event, but it's not doing anything
 yet.
To do something, pass a function to the blur():
 
$('#test').blur(function() { });
 
which, when fleshed out a little more, might look like:
 
$('#test').blur(function() {
 alert('I just got blurred!');
 
});
 
While inside these inner functions, you have a handle on the
 element
   that
triggered it.  It's referred to as $(this).  You can also use plain
 ol'
javascript and use 'this' (no quotes).  Depends on what you're doing
   with
it.
 
$('#test').blur(function() {
 alert(this.id);
 alert($(this).attr('id'));  // they do the same thing
 
});
 
Most of this (if not all of it) is covered in the docs.
 
   http://docs.jquery.com/andhttp://docs.jquery.com/How_jQuery_Works
 
On Tue, Sep 29, 2009 at 1:04 PM, factoringcompare.com 
 
firstfacto...@googlemail.com wrote:
 
 Thank you. Could you elaborate on the code so that I can track it
 through and understand
 
 On Sep 29, 8:49 pm, Charlie Griefer charlie.grie...@gmail.com
 wrote:
  $('#test').blur(function() {
  $(this).val($(this).val().replace(/,/g,''));
 
  });
 
  You call it by telling jQuery to listen for the blur() event
 on
   the
  element with id=test (line 1 above).
 
  Your code was correct, but you can replace the $('input#test')
 with
 $(this),
  since $(this) will be a reference to the element that triggered
 the
   blur.
 
  On Tue, Sep 29, 2009 at 12:04 PM, factoringcompare.com 
 
  firstfacto...@googlemail.com wrote:
 
   Hi,
 
   New to jQuery.
 
   I would like to strip out all of the commas in numeric text
 field
   called test on blur. New to jQuery. I have had a go at coding
 would
   it
   work?
 
   $('input#test').val($('input#test').val().replace(/,/g,''));
 
   and ... how do i calll it?
 
  --
  Charlie Grieferhttp://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I
 love
   my
  wife. And I wish you my kind of success.
 
--
Charlie Grieferhttp://charlie.griefer.com/
 
I have failed as much as I have succeeded. But I love my life. I love
 my
wife. And I wish you my kind of success.- Hide quoted text -
 
- Show quoted text -
 
  --
  Charlie Grieferhttp://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.- Hide quoted text -
 
  - Show quoted text -




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: How to handle dynamic clicks?

2009-09-28 Thread Charlie Griefer
You shouldn't need to use a named function, or an inline onclick.

If you can move that id attribute into the a tag itself, you could do:

spana href=# id=doedit_$comment[commentid] ... /a/span

and then your jQuery would be:

$(document).ready(function() {
 $('a[id^=doedit_]').click(function() {
  alert(this.id);  -- shows that you have a handle on the specific
element that triggered the click
  return false;
 });
})


On Mon, Sep 28, 2009 at 4:34 AM, lionel28 lmarte...@haitiwebs.net wrote:



 Hi,

 I am trying to get the correct div from a form

 I did (I intentionally left the brackets open so it displays here)
 span id=doedit_$comment[commentid] a onclick= return
 getCommentID($comment[commentid])

 and for the jQuery

 $(document).ready(function() {

 function getCommentID(cid)
 {

  $(#doedit_ + cid).click(function() {

  $(div#newcomment).slideUp(slow);
  $(div#editcomment_ + cid).slideDown(slow);

 }
   });


 But nothing is happening.

 Please what is the proper syntax?

 Thank you
 --
 View this message in context:
 http://www.nabble.com/How-to-handle-dynamic-clicks--tp25644199s27240p25644199.html
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: How to handle dynamic clicks?

2009-09-28 Thread Charlie Griefer
Hi Lionel:

I've not bought a JavaScript book in ages.  But the one that I learned from
a while back is the JavaScript Bible by Danny Goodman.  A quick Amazon
search shows that a 7th Edition is in pre-release status (glad to hear) :)

If you want a jQuery book, there are a couple of ways to go.  There's
jQuery in Action published by Manning.  Learning jQuery 1.3 by Packt has
some big jQuery names as authors.  A new pdf book was just released (you can
also pay extra for a bound copy) at http://jqueryenlightenment.com/.  I
bought that last week but haven't had a chance to get to it yet.

On Mon, Sep 28, 2009 at 12:34 PM, lionel28 lmarte...@haitiwebs.net wrote:



 Charlie,

 Thank you very much.
 I was able to do a split so I get actual value from your code and all is
 fine.

 I do whatever I want with php, but could you recommend a book for
 Javascript.

 Example: for the split I had to do a Google search :thinking:

 A book with all those easy code like yours, like the split would be great.

 Thanks again.

 Charlie Griefer wrote:
 
  You shouldn't need to use a named function, or an inline onclick.
 
  If you can move that id attribute into the   tag itself, you could do:
 
   #  ...
 
  and then your jQuery would be:
 
  $(document).ready(function() {
   $('a[id^=doedit_]').click(function() {
alert(this.id);  -- shows that you have a handle on the
  specific
  element that triggered the click
return false;
   });
  })
 
 
  On Mon, Sep 28, 2009 at 4:34 AM, lionel28 lmarte...@haitiwebs.net
 wrote:
 
 
 
  Hi,
 
  I am trying to get the correct div from a form
 
  I did (I intentionally left the brackets open so it displays here)
  span id=doedit_$comment[commentid] a onclick= return
  getCommentID($comment[commentid])
 
  and for the jQuery
 
  $(document).ready(function() {
 
  function getCommentID(cid)
  {
 
   $(#doedit_ + cid).click(function() {
 
   $(div#newcomment).slideUp(slow);
   $(div#editcomment_ + cid).slideDown(slow);
 
  }
});
 
 
  But nothing is happening.
 
  Please what is the proper syntax?
 
  Thank you
  --
  View this message in context:
 
 http://www.nabble.com/How-to-handle-dynamic-clicks--tp25644199s27240p25644199.html
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com.
 
 
 
 
  --
  Charlie Griefer
  http://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.
 
 

 --
 View this message in context:
 http://www.nabble.com/How-to-handle-dynamic-clicks--tp25644199s27240p25651479.html
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: How to handle dynamic clicks?

2009-09-28 Thread Charlie Griefer
Incidentally... not sure why you'd need to use split() for your needs
there?  Could you post some code or explain what your requirement is?  You
may be going about it the long way (or I may be misunderstanding what you're
trying to do) :)

On Mon, Sep 28, 2009 at 12:42 PM, Charlie Griefer charlie.grie...@gmail.com
 wrote:

 Hi Lionel:

 I've not bought a JavaScript book in ages.  But the one that I learned from
 a while back is the JavaScript Bible by Danny Goodman.  A quick Amazon
 search shows that a 7th Edition is in pre-release status (glad to hear) :)

 If you want a jQuery book, there are a couple of ways to go.  There's
 jQuery in Action published by Manning.  Learning jQuery 1.3 by Packt has
 some big jQuery names as authors.  A new pdf book was just released (you can
 also pay extra for a bound copy) at http://jqueryenlightenment.com/.  I
 bought that last week but haven't had a chance to get to it yet.


 On Mon, Sep 28, 2009 at 12:34 PM, lionel28 lmarte...@haitiwebs.netwrote:



 Charlie,

 Thank you very much.
 I was able to do a split so I get actual value from your code and all is
 fine.

 I do whatever I want with php, but could you recommend a book for
 Javascript.

 Example: for the split I had to do a Google search :thinking:

 A book with all those easy code like yours, like the split would be great.

 Thanks again.

 Charlie Griefer wrote:
 
  You shouldn't need to use a named function, or an inline onclick.
 
  If you can move that id attribute into the   tag itself, you could do:
 
   #  ...
 
  and then your jQuery would be:
 
  $(document).ready(function() {
   $('a[id^=doedit_]').click(function() {
alert(this.id);  -- shows that you have a handle on the
  specific
  element that triggered the click
return false;
   });
  })
 
 
  On Mon, Sep 28, 2009 at 4:34 AM, lionel28 lmarte...@haitiwebs.net
 wrote:
 
 
 
  Hi,
 
  I am trying to get the correct div from a form
 
  I did (I intentionally left the brackets open so it displays here)
  span id=doedit_$comment[commentid] a onclick= return
  getCommentID($comment[commentid])
 
  and for the jQuery
 
  $(document).ready(function() {
 
  function getCommentID(cid)
  {
 
   $(#doedit_ + cid).click(function() {
 
   $(div#newcomment).slideUp(slow);
   $(div#editcomment_ + cid).slideDown(slow);
 
  }
});
 
 
  But nothing is happening.
 
  Please what is the proper syntax?
 
  Thank you
  --
  View this message in context:
 
 http://www.nabble.com/How-to-handle-dynamic-clicks--tp25644199s27240p25644199.html
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com.
 
 
 
 
  --
  Charlie Griefer
  http://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.
 
 

 --
 View this message in context:
 http://www.nabble.com/How-to-handle-dynamic-clicks--tp25644199s27240p25651479.html
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.




 --
 Charlie Griefer
 http://charlie.griefer.com/

 I have failed as much as I have succeeded. But I love my life. I love my
 wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Apply CSS to dynamic content after it loads

2009-09-28 Thread Charlie Griefer
you can chain on an .addClass('myClassName') ?

On Mon, Sep 28, 2009 at 3:09 PM, Sloan Thrasher sl...@sloanthrasher.comwrote:

  Hi!

 I've got a page that loads dynamic content, sometimes including links. The
 CSS seems to apply to the loaded CSS, except for a rule that adds an
 offsite icon to the end of the link.
 I've used Firefind to verify the css selector in the css, and it applies to
 the correct elements, but the icon doesn't show up.
 Is there anything I need to do after loading the dynamic content to apply
 the css?

 Sloan





-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Every post I make, I get an mail error.

2009-09-27 Thread Charlie Griefer
Karl - This was happening to me a few weeks ago (from a different @localhost
address).  Rey took care of it.  He may have taken care of this one as well.



On Sun, Sep 27, 2009 at 5:51 PM, Karl Swedberg k...@englishrules.comwrote:

 Hmmm.  I just searched through all jquery-en members and couldn't find
 r...@localhost listed. Maybe one of the other admins already deleted it?

 --Karl

 
 Karl Swedberg
 www.englishrules.com
 www.learningjquery.com




 On Sep 26, 2009, at 4:38 PM, Scott Haneda wrote:


 I believe what happens, is there is a bad address in the group, so when you
 post a message to the list, it is sent out to all subscribers.

 Final-Recipient: rfc822; r...@localhost
 Original-Recipient: rfc822;r...@localhost
 Action: failed
 Status: 5.3.0

 If an email is sent from the group to r...@localhost, it will bounce, and
 I am guessing it is bouncing back to the group.  Some people are getting
 this backscatter, and others are not.  If I were to look at my server logs,
 I would bet I see it, but I have my server set to block messages that are
 backscatter, or have bogus recipients and destinations.

 The list admin needs to find r...@localhost I believe, that would solve
 it, though I think the issue is technically deeper than that quick fix.

 --
 Scott * If you contact me off list replace talklists@ with scott@ *

 On Sep 26, 2009, at 8:10 AM, Charlie wrote:

 I posted this issue into Google Groups help forum yesterday, only response
 so far group won't recognize your email address which is not true


 Will see what happens


 Bertilo Wennergren wrote:



 evo wrote:


 Everytime I post to this group through thunderbird, I get a

 undelivered mail message sent back, everytime.

 This has only started happening recently and I can't find any info

 about it anywhere.


 Just want to know if this is happening to anyone else (as it's only

 when I post to this group)


 I get those too.






-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] getJSON callback not firing?

2009-09-25 Thread Charlie Griefer
Hey all:

I've read the docs and googled the heck out of this, but not seeing what the
problem is.

I'm trying to get some data from the server via the getJSON() method.  I do
see a response in firebug and I've validated the response data at
JSONLint.com.  However, the callback function simply will not fire.  I've
tried to simplify things as much as possible.  The CFC returning the data is
in the same directory as the calling page.  The callback function, for now,
should only alert a simple text string (which has evolved from hi to foo
to a censored version below as the hours have passed).

$(document).ready(function() {
$('a.players').click(function() {
$.getJSON(

'data.cfc?method=getPlayerByIDreturnformat=JSONqueryformat=columnplayerID='
+ this.id,
function(data) {
alert('i %!%##%* hate you');
});
return false;
});
});

Here's the response I receive:

{ROWCOUNT:1,COLUMNS:[PLAYERID,PLAYERNAME,PLAYERNUMBER,PLAYERPOSITION,PLAYERIMG,PLAYERCOLLEGE],DATA:{PlayerID:[1],PlayerName:[Barden,
Ramses],PlayerNumber:[13],PlayerPosition:[WR],PlayerImg:[http:\/\/
assets.giants.com\/uploads\/players\/2FE2D3BDF4FB443D949D1D39B69ADC03.gif],PlayerCollege:[Cal
Poly]}}

...which when pasted into JSONLint returns valid.

If anyone has any ideas, or if there's any additional information that I can
provide, I'm all ears.

Thanks!
Charlie

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: getJSON callback not firing?

2009-09-25 Thread Charlie Griefer
Z: thanks for the response.  I'm making my initial foray into using jQuery
for AJAX (up 'til now, had only used it for page manipulations).

Given your response... would there ever be a situation where .getJSON()
would be preferable to .ajax()?  It seems odd that jQuery would have 2
methods that essentially do the same thing.  Especially if one is near
impossible to debug.

Thanks,
Charlie

On Fri, Sep 25, 2009 at 11:58 AM, MorningZ morni...@gmail.com wrote:


 I'd suggest using the more generic $.ajax method so you can actually
 catch the error, as the $.getJSON fails silently, which is no good for
 programmers  :-(

 $.ajax({
 type: GET,
 url: your URL,
 processData = true,
 data: {},
 dataType: json,
 success: function(json) {
  alert(success);
 },
 error: function(x,y,z) {
 // x.responseText should have what's wrong
 }
 });

 On Sep 25, 2:06 pm, Charlie Griefer charlie.grie...@gmail.com wrote:
  Hey all:
 
  I've read the docs and googled the heck out of this, but not seeing what
 the
  problem is.
 
  I'm trying to get some data from the server via the getJSON() method.  I
 do
  see a response in firebug and I've validated the response data at
  JSONLint.com.  However, the callback function simply will not fire.  I've
  tried to simplify things as much as possible.  The CFC returning the data
 is
  in the same directory as the calling page.  The callback function, for
 now,
  should only alert a simple text string (which has evolved from hi to
 foo
  to a censored version below as the hours have passed).
 
  $(document).ready(function() {
  $('a.players').click(function() {
  $.getJSON(
 
 
 'data.cfc?method=getPlayerByIDreturnformat=JSONqueryformat=columnplayerID='
  + this.id,
  function(data) {
  alert('i %!%##%* hate you');
  });
  return false;
  });
 
  });
 
  Here's the response I receive:
 
 
 {ROWCOUNT:1,COLUMNS:[PLAYERID,PLAYERNAME,PLAYERNUMBER,PLAYERPOSITION,PLAYERIMG,PLAYERCOLLEGE],DATA:{PlayerID:[1],PlayerName:[Barden,
 
 Ramses],PlayerNumber:[13],PlayerPosition:[WR],PlayerImg:[http:\/\/
  assets.giants.com
 \/uploads\/players\/2FE2D3BDF4FB443D949D1D39B69ADC03.gif],PlayerCollege:[Cal
  Poly]}}
 
  ...which when pasted into JSONLint returns valid.
 
  If anyone has any ideas, or if there's any additional information that I
 can
  provide, I'm all ears.
 
  Thanks!
  Charlie
 
  --
  Charlie Grieferhttp://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Elements with similar names

2009-09-25 Thread Charlie Griefer
$('input[name^=tx_qtde]')

See Attribute Filters at http://docs.jquery.com/Selectors

On Fri, Sep 25, 2009 at 7:12 PM, Carlos Santos carloeasan...@gmail.comwrote:


 I have in one form, many, many text fields with similar names such
 as:

 tx_qtde1
 tx_qtde2
 tx_qtde3

 how i can select all this text fields without using a class, something
 like:

 $(tx_qtde * )

 where the * is the numbers.

 Thanks for your time.
 Carlos Santos




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Multiple Links, Find which one was clicked?

2009-09-24 Thread Charlie Griefer
$('a.accept').click(function() {
alert($(this).closest('tr').attr('id'));
});

On Thu, Sep 24, 2009 at 11:22 AM, Steven html...@gmail.com wrote:


 I have a table that looks something like this:

 tr id=1
 tdName/td
 tdE-Mail/td
 tda href=# class=acceptAccept/a - a href=#
 class=denyDeny/a/td
 /tr

 With multiple rows. Each row has a unique ID (numerical). I need to be
 able to click on an a.accept, find WHICH one was clicked (which row it
 is in), and get the ID of that row. I've been looking around and I
 found parent(), but I'm not sure how I can specifically get which
 accept link was clicked.

 Can anyone help?




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Multiple Links, Find which one was clicked?

2009-09-24 Thread Charlie Griefer
Steven:

It seems to be working here (quick sample thrown together):

http://charlie.griefer.com/getRowID.html

?

On Thu, Sep 24, 2009 at 11:55 AM, Steven html...@gmail.com wrote:


 I cannot seem to get that to work, although it does make sense. I'm
 using Ajax to load the tables in; I don't know if that is the cause. I
 did try it on a static page and it still did nothing though.

 On Sep 24, 12:36 pm, Charlie Griefer charlie.grie...@gmail.com
 wrote:
  $('a.accept').click(function() {
  alert($(this).closest('tr').attr('id'));
 
  --
  Charlie Grieferhttp://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Multiple Links, Find which one was clicked?

2009-09-24 Thread Charlie Griefer
Ah, yeah.  I should have checked to see if you were on 1.3.

Assuming you can move up to 1.3, you can use the live() method (now
built-in).

I think you'd be able to get by changing your first line to:

$('#pending').live('click', function({



On Thu, Sep 24, 2009 at 12:05 PM, Steven html...@gmail.com wrote:


 I was running on 1.2 for some reason. :( Anyway, it works perfectly on
 static pages, but when I load the table in via Ajax none of the links
 are bound. I'm doing:
// Click events to load requests
$('#pending').click(function(){
$('#list').hide(600).load('list.php',{type:
 'pending'}).show(600);
$('#description').html(pending);
});
 To load the tables.

 On Sep 24, 12:59 pm, Charlie Griefer charlie.grie...@gmail.com
 wrote:
  Steven:
 
  It seems to be working here (quick sample thrown together):
 
  http://charlie.griefer.com/getRowID.html
 
  ?
 
 
 
  On Thu, Sep 24, 2009 at 11:55 AM, Steven html...@gmail.com wrote:
 
   I cannot seem to get that to work, although it does make sense. I'm
   using Ajax to load the tables in; I don't know if that is the cause. I
   did try it on a static page and it still did nothing though.
 
   On Sep 24, 12:36 pm, Charlie Griefer charlie.grie...@gmail.com
   wrote:
$('a.accept').click(function() {
alert($(this).closest('tr').attr('id'));
 
--
Charlie Grieferhttp://charlie.griefer.com/
 
I have failed as much as I have succeeded. But I love my life. I love
 my
wife. And I wish you my kind of success.
 
  --
  Charlie Grieferhttp://charlie.griefer.com/
 
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.




-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Add content

2009-09-24 Thread Charlie Griefer
On Thu, Sep 24, 2009 at 2:03 PM, a1anm alanmoor...@gmail.com wrote:


 Hi,

 I have an unordered list and I would like to use Jquery to add some
 li's to it.

 How do I do this?

 Thanks!


http://docs.jquery.com/Manipulation/append

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Way to convert DOM event to jQuery event?

2009-09-23 Thread Charlie Griefer
On Tue, Sep 22, 2009 at 4:41 PM, WalterGR walte...@gmail.com wrote:


 On Sep 22, 4:35 pm, Ricardo ricardob...@gmail.com wrote:

  This doesn't make any sense. If you're already using jQuery why keep
  your handler in the HTML?

 Because I need to pass additional information to the event handler in
 a clean way.  (i.e. rather than hacks using various attributes on the
 anchor.)  Is there a non-hackish way to do this?



Hi Walter:

Sort of along the lines of what Scott had suggested, but rather than using a
plugin, could you use jQuery's built in data() method?

http://docs.jquery.com/Core/data#namevalue

Assuming you're generating these links dynamically you could assign the
'foobarbaz' value to an element with a particular ID.

$(document).ready(function() {
 $('#myID').data('myFirstArg', 'foobarbaz');

 $('#myID').click(function() {
  alert($(this).data('myFirstArg'));
  return false;
 });
});

a href=# id=myIDshow details/a

That's a fairly simplistic example.  The example in the docs shows how you
can store complex data using JSON.

Would something like that work?

Charlie

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Simple CSS selector Question

2009-09-17 Thread Charlie Griefer
Pretty sure you need single quotes around bar.

alert($(input[name='bar']).val());

On Thu, Sep 17, 2009 at 1:27 AM, pritisolanki pritiatw...@gmail.com wrote:


 Thanks Ralph.

 I tried following

  alert($(input[name=bar]).val());

 and rather then showing it's value it alert undefined ??? why?

 I am sorry if this is very basic question.

 On Sep 16, 4:11 pm, Ralph Whitbeck ralph.whitb...@gmail.com wrote:
  Take out the @ in your attribute selectors.  The @ was depricated in
 jQuery
  1.2 and taken out in 1.3. So your new selectors will look like...
 
  1. $(input[name=bar])
 
  2. $(p[class])
 
  documentationhttp://
 docs.jquery.com/Selectors/attributeHas#attributehttp://docs.jquery.com/Selectors/attributeEquals#attributevalue
 
  Ralph
 
  On Wed, Sep 16, 2009 at 2:36 AM, pritisolanki pritiatw...@gmail.com
 wrote:
 
   Hi,
 
   I am a beginner in Jquery who simply set up the configs and start
   exploring.please help me in following. I have starter kit html page.
 
  form
  Form 2
  input name=bar value=YYY /
  input /
  /form
 
   p
   p class=stuffOkie this is hiding example /p
   /p
 
   In script tag following things do not take effects
   1. alert($(inp...@name=bar]).val()); - it suppose to alert the value
   of this input.
   2. $(p...@class]).hide(); - My understanding is inner p tag should
   get hide




-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Simple CSS selector Question

2009-09-17 Thread Charlie Griefer
Hi Karl:

Hate to hijack the thread, but hopefully it's somewhat relevant to the
original post.

When I suggested the single quotes around the value 'bar', I was going off
of what I saw in the docs at
http://docs.jquery.com/Selectors/attributeEquals#attributevalue

And the code sample:
$(input[name='newsletter']).next().text( is newsletter);

I still consider myself relatively new to jQuery, so could you clarify about
quoting the attribute value?  Is it similar to terminating a line with a
semi-colon (e.g. optional in JS)?  Or is it literal text vs variable value
(assuming -bar- here is a variable)?

Thanks!
Charlie

On Thu, Sep 17, 2009 at 9:06 AM, Karl Swedberg k...@englishrules.comwrote:


 On Sep 17, 2009, at 5:13 AM, Charlie Griefer wrote:

 Pretty sure you need single quotes around bar.

 alert($(input[name='bar']).val());


 No. The single quotes are unnecessary.

 On Thu, Sep 17, 2009 at 1:27 AM, pritisolanki pritiatw...@gmail.com
  wrote:


 Thanks Ralph.

 I tried following

  alert($(input[name=bar]).val());

 and rather then showing it's value it alert undefined ??? why?


 Where are you including your script tag? If it's in the head, are you
 wrapping your alert() in $(document).ready? Are you sure you have an input
 with name=bar?

 Try this:

 $(document).ready(function() {
   alert( $(input[name=bar]).val() );
 });


 --Karl

 
 Karl Swedberg
 www.englishrules.com
 www.learningjquery.com





-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Simple CSS selector Question

2009-09-17 Thread Charlie Griefer
Hi Karl:

That clears it up completely.  Thanks!

Charlie

On Thu, Sep 17, 2009 at 10:43 AM, Karl Swedberg k...@englishrules.comwrote:

 Hey Charlie,
 It all comes down to the way the string is parsed. The Sizzle selector
 engine uses a Regular Expression to detect whether an attribute selector is
 being used:

 ATTR:
 /\[\s*((?:[\w\u00c0-\u_-]|\\.)+)\s*(?:(\S?=)\s*([']*)(.*?)\3|)\s*\]/,

 The parts of the regex that deal with quotation marks around the attribute
 value are ([']*) and \3. The part that actually captures the attribute
 value is (.*?)
 So, it allows for single, double, or no quotation marks around the
 attribute value in the selector.

 Come to think of it, it also allows for multiple quotation marks. Strange,
 but this would work, too:
 $(input[name='''newsletter'''])

 It isn't really related to literal text vs. variable value. In order to
 pass in a variable, you need to concatenate it:

 var foo = 'newsletter';
 $(input[name= + foo + ])

 Hope that helps explain.

 --Karl

 
 Karl Swedberg
 www.englishrules.com
 www.learningjquery.com




 On Sep 17, 2009, at 12:22 PM, Charlie Griefer wrote:

 Hi Karl:

 Hate to hijack the thread, but hopefully it's somewhat relevant to the
 original post.

 When I suggested the single quotes around the value 'bar', I was going off
 of what I saw in the docs at
 http://docs.jquery.com/Selectors/attributeEquals#attributevalue

 And the code sample:
 $(input[name='newsletter']).next().text( is newsletter);

 I still consider myself relatively new to jQuery, so could you clarify
 about quoting the attribute value?  Is it similar to terminating a line with
 a semi-colon (e.g. optional in JS)?  Or is it literal text vs variable value
 (assuming -bar- here is a variable)?

 Thanks!
 Charlie

 On Thu, Sep 17, 2009 at 9:06 AM, Karl Swedberg k...@englishrules.comwrote:


 On Sep 17, 2009, at 5:13 AM, Charlie Griefer wrote:

 Pretty sure you need single quotes around bar.

 alert($(input[name='bar']).val());


 No. The single quotes are unnecessary.

  On Thu, Sep 17, 2009 at 1:27 AM, pritisolanki pritiatw...@gmail.com
  wrote:


 Thanks Ralph.

 I tried following

  alert($(input[name=bar]).val());

 and rather then showing it's value it alert undefined ??? why?


 Where are you including your script tag? If it's in the head, are you
 wrapping your alert() in $(document).ready? Are you sure you have an input
 with name=bar?

 Try this:

 $(document).ready(function() {
   alert( $(input[name=bar]).val() );
 });


 --Karl

 
 Karl Swedberg
 www.englishrules.com
 www.learningjquery.com





 --
 I have failed as much as I have succeeded. But I love my life. I love my
 wife. And I wish you my kind of success.





-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: How to get mouseover and mouseout action to take place after changing div with jquery post method

2009-09-17 Thread Charlie Griefer
On Thu, Sep 17, 2009 at 9:02 AM, Ben lbw...@gmail.com wrote:


 My question is if i used jquery post method to change some div
 content, than this new div won't have mouseover and mouseout affect
 anymore, is there anyway to achieve it. Is that needed to trigger
 ready function again?


Have a look at the live() method:
http://docs.jquery.com/Events/live

Another question is can anyone teach me how to add click and dblclick
 event to the same div, because if i add both of them then it won't
 trigger dblckick event.Thanks a lot. :-)


Dunno this one, but would be interested in hearing if it can be done (and
how) :)

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Error when update jquery from 1.2.4 to 1.3.2

2009-09-16 Thread Charlie Griefer
In 1.3 the @ was deprecated.

see http://docs.jquery.com/Release:jQuery_1.3 under Changes

now you just want $(form[name='adminform']).submit();

On Wed, Sep 16, 2009 at 9:03 PM, tongkienphi tongkien...@gmail.com wrote:


 Hi every body.

 In my porject use jquery version 1.2.4, but this version can not run
 Calendar app because in this app have use version 1.3.2 .. When i
 updated to 1.3.2 script Calendar work well but in my project have
 errror somewhere ..

 ex: on line 1642 have error from .. throw Syntax error, unrecognized
 expression:  + expr;
 In the versioin 1.2.4 i use this code before to submit form

 $(fo...@name=adminform]).submit();

 but in the version 1.3.2 this code not work.




-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: selectors, events, and scripted elements not working

2009-09-15 Thread Charlie Griefer
Have a look at live()

http://docs.jquery.com/Events/live

Binds a handler to an event (like click) for all current - and future -
matched element.

Basically, when you add elements to the DOM dynamically after page load,
jQuery won't recognize those elements unless the live() method is used.

On Tue, Sep 15, 2009 at 4:20 PM, rob rob.sche...@gmail.com wrote:


 Hello,

 I am having some problems with selectors and events.  I have a row of
 thumbnails all part of the thumbnails class.  I'm trying to run some
 code when a thumbnail is clicked, but something weird is happening.

 When i use this selector/event:
  $(.thumbnails).click(function(){ // run some code });

 nothing happens.

 I've tested this:
  $(img).click(function(){ // run some code });

 And the code does run on what seems like all img that are set in the
 HTML doc, but not the img elements that are created from JQuery
 script.

 Can anyone help to explain this?  What am I doing wrong here?

 For reference:

 The jquery script creating elements is:

 $(function(){
 var image = new Image();

 $(img).attr('src', path)
 $(img).attr('class', thumbnails);

 $('#thumbnailwrapper').append(img);




-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: $(this).css({color : red})

2009-09-12 Thread Charlie Griefer
These both work for me:

http://pastebin.com/m3701f681
http://pastebin.com/m62f8b24b


On Sat, Sep 12, 2009 at 9:58 AM, Matthew Rolph marine.ro...@gmail.comwrote:


 http://testingspot.hostcell.net/sandbox/tests/css.jquery.test.html
 it somehow doesn't work at all not even the css
 does it matter where the style and scripts are in the of the document

 On 9/12/09, Mike Alsup mal...@gmail.com wrote:
 
  see that code in the subj.? i'm using FF 3.5, and no matter what i
  do, .css won't work!! any help?
 
  Maybe this isn't what you think it is.  Can you post some code or a
  link?




-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: $(this).css({color : red})

2009-09-12 Thread Charlie Griefer
as does this:

http://pastebin.com/m58a02ab3

On Sat, Sep 12, 2009 at 10:05 AM, Charlie Griefer charlie.grie...@gmail.com
 wrote:

 These both work for me:

 http://pastebin.com/m3701f681
 http://pastebin.com/m62f8b24b



 On Sat, Sep 12, 2009 at 9:58 AM, Matthew Rolph marine.ro...@gmail.comwrote:


 http://testingspot.hostcell.net/sandbox/tests/css.jquery.test.html
 it somehow doesn't work at all not even the css
 does it matter where the style and scripts are in the of the document

 On 9/12/09, Mike Alsup mal...@gmail.com wrote:
 
  see that code in the subj.? i'm using FF 3.5, and no matter what i
  do, .css won't work!! any help?
 
  Maybe this isn't what you think it is.  Can you post some code or a
  link?




 --
 I have failed as much as I have succeeded. But I love my life. I love my
 wife. And I wish you my kind of success.




-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: $(this).css({color : red})

2009-09-12 Thread Charlie Griefer
All 3 of the samples I pasted above (the pastebin links) work in FF3.5 (on
OS X)

On Sat, Sep 12, 2009 at 5:07 PM, Matthew Rolph marine.ro...@gmail.comwrote:

 it's still not working right so i'm getting safari and seeing if that works
 out


 On Sat, Sep 12, 2009 at 1:10 PM, jhm jmay...@gmail.com wrote:


 The code on that page doesn't match the code in your file. Yours is
 missing the curly brackets:

$(p.blue).css(color : red);

 should be

$(p.blue).css({color : red});

 Any syntax error like that will stop the script dead.


 On Sep 12, 9:58 am, Matthew Rolph marine.ro...@gmail.com wrote:
  http://testingspot.hostcell.net/sandbox/tests/css.jquery.test.html
  it somehow doesn't work at all not even the css
  does it matter where the style and scripts are in the of the document
 
  On 9/12/09, Mike Alsup mal...@gmail.com wrote:
 
 
 
   see that code in the subj.? i'm using FF 3.5, and no matter what i
   do, .css won't work!! any help?
 
   Maybe this isn't what you think it is.  Can you post some code or a
   link?





-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: jquery offline Help document

2009-09-06 Thread Charlie Griefer
On Sun, Sep 6, 2009 at 9:22 PM, vipin vipinpaliwal1...@gmail.com wrote:


 How can i get jquery API offline help document.



See http://docs.jquery.com/Alternative_Resources for some options.


-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Clickable div?

2009-09-04 Thread Charlie Griefer
I don't know that you can use a filter the way you're trying to (using the
colon in #logo:a).

Filters are more like tr:first (matches the first tr element), tr:odd
(matches odd-numbered table rows.. good for zebra-striping)...

See the sections about the various types of filters at
http://docs.jquery.com/Selectors.

As far as your issue...

the 'a' in question is a child of the #logo element, so you'd want

$('#logo  a').click(function() { });

http://docs.jquery.com/Selectors/child#parentchild

On Fri, Sep 4, 2009 at 10:53 AM, lukas animod...@gmail.com wrote:


 Thank you! It somehow does not work.

 Here is what I got:
 $(#logo:a).click(function(){
$.cookie('startCookie', 'default').load('
 http://www.mylink.com');
});

 And here is the html:
div id=logoa href=template language defines the link here/
 a/div

 Does anybody have an idea?




-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Clickable div?

2009-09-04 Thread Charlie Griefer
Oooh good call.  I had forgotten :)

On Fri, Sep 4, 2009 at 10:20 AM, MorningZ morni...@gmail.com wrote:


 and don't forget to add the css  cursor: pointer to make the user's
 mouse cursor look like a link


 On Sep 4, 1:15 pm, Charlie Griefer charlie.grie...@gmail.com wrote:
  does that div have an id attribute?  if so,
 
  $('myDivID').click(function() { do stuff here });
 
  On Fri, Sep 4, 2009 at 10:13 AM, lukas animod...@gmail.com wrote:
 
   I have a div that only contains an image.
   How would I create a jquery-click function that basically would
   represent a normal a tag for his div?
   Thank you!
 
  --
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.




-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Clickable div?

2009-09-04 Thread Charlie Griefer
does that div have an id attribute?  if so,

$('myDivID').click(function() { do stuff here });

On Fri, Sep 4, 2009 at 10:13 AM, lukas animod...@gmail.com wrote:


 I have a div that only contains an image.
 How would I create a jquery-click function that basically would
 represent a normal a tag for his div?
 Thank you!




-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Do I need to include whole JQuery file ?

2009-09-03 Thread Charlie Griefer
On Thu, Sep 3, 2009 at 4:28 AM, Gaurang Mistry gaura...@gmail.com wrote:


 Hello,
 I am new to jquery.

 I am using only hide and show functions.

 Do I need to include whole jquery file ?
 Which part of file I need to remove ?


I think manipulating the core file in any way is a bad idea.  I mean orders
of magnitude bad.

You're only using hide and show now.  What if a week from now you want to
toggle() something?  What if you want to get or set an attribute value via
attr()?  What if you want to... well, you get the picture.

The whole jquery file is relatively small.  Especially if it's minified.
You can also load it up via google.  This way it'd already be cached in a
user's browser if they've previously gone to a site that called the jQuery
code from google.

script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js
/script

But really... modifying the core file is the absolute last thing I'd
suggest.

-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Help getting elements name.

2009-09-02 Thread Charlie Griefer
$('input:radio').click(function() { alert(this.name); });

But... as radio buttons, wouldn't they all have the same name?

In any event, 'this' (or the jQuery $(this)) will give you a hook into the
element that triggered the click.

On Wed, Sep 2, 2009 at 12:44 PM, gilberto.ramoso...@gmail.com 
gilberto.ramoso...@gmail.com wrote:


 Hello I have a bunch of radio button and I want a funtion tu run when
 any of the radio button is clicked so I used $('input:radio').click
 (function... what I want to do is to get the name attribute of the
 clicked radio, how can i do this?




-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: How can I manipulate all the radios in one div?

2009-09-02 Thread Charlie Griefer
assuming the particular div has an id=myDiv attribute...

$('myDiv input:radio')

http://docs.jquery.com/Selectors/descendant#ancestordescendant

(the docs are your friend)

You could also apply a specific class name to the ones you want to
manipulate.  But if you don't want to (or can't) manipulate the markup, the
code above should work.

On Wed, Sep 2, 2009 at 4:12 PM, gilberto.ramoso...@gmail.com 
gilberto.ramoso...@gmail.com wrote:


 How can I manipulate all the radios in a div? For example say I have 2
 div and both have a couple of radio buttons and everyone has different
 names. Say I wanted to manipulate only the radios in one of the div's
 how could achieve that?




-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Easy SELECT question for newbie

2009-08-30 Thread Charlie Griefer
#3 errors because as of jQuery 1.3, the use of the @ symbol is deprecated.

$('input[id$=ckKyW]') -- all input elements with an id attribute that
ENDS WITH 'ckKyW'

see the Attribute Filters section of http://docs.jquery.com/Selectors

On Sun, Aug 30, 2009 at 7:31 AM, gBerger crapper_m...@att.net wrote:


 I am an extreme beginner so sorry for the basic question.

 I have a number of checkboxes on the screen that contain
 an ID with the characters ckKyW in it.
 Checkbox Examples:
  whatever_ckKyW34
  whatnow_ckKyW67
  whoops_ckKyW23

 I have tried every combination that I could think of
 (a few of them are below) but I am not able to retrieve
 only these checkboxes.  #1 below retrieves ALL checkboxes
 but I know there is a way to retrieve only the ones I need.

 Can some help me please.

 Thanks,
 gBerger



 #1
 This works [ and I was proud of myself for getting this far :)  ]
 //var sChkBoxes = $(form :checkbox).each(function()
 //{
 //alert(this.id);
 //}
 //);


 #2
 // NO ERROR JUST DOESNT RETURN ANYTHING
 //var s3 = ;
 //$(form :checkbox).find(a...@id*='ckKyW']).each(function()
 //{
 //alert(this.id);
 //}
 //);

 #3
 // ERRORS
 //$([...@id*='ckKyW']).each(function() {
 //alert(this.id);
 //}
 //);
 //$(a...@id*='ckKyW']).each(function() {
 //alert(this.id);
 //}
 //);




-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Easy SELECT question for newbie

2009-08-30 Thread Charlie Griefer
No reason to be embarrassed.  Everyone starts somewhere.

Hell, compared to many of the folks on this list, I'm still a n00b.  Just
keep at it, refer to the docs early and often, and don't be afraid to ask
questions as they come up.

On Sun, Aug 30, 2009 at 11:23 AM, gBerger crapper_m...@att.net wrote:


 Thanks.  That did the trick.

 I actually spent at least a couple of hours on this.  embarrassed to
 say
 I looked and looked for examples and thought I tried every conceivable
 example.

 Thanks again,
 gBerger

 On Aug 30, 1:18 pm, Charlie Griefer charlie.grie...@gmail.com wrote:
  #3 errors because as of jQuery 1.3, the use of the @ symbol is
 deprecated.
 
  $('input[id$=ckKyW]') -- all input elements with an id attribute that
  ENDS WITH 'ckKyW'
 
  see the Attribute Filters section ofhttp://docs.jquery.com/Selectors
 
 
 
  On Sun, Aug 30, 2009 at 7:31 AM, gBerger crapper_m...@att.net wrote:
 
   I am an extreme beginner so sorry for the basic question.
 
   I have a number of checkboxes on the screen that contain
   an ID with the characters ckKyW in it.
   Checkbox Examples:
whatever_ckKyW34
whatnow_ckKyW67
whoops_ckKyW23
 
   I have tried every combination that I could think of
   (a few of them are below) but I am not able to retrieve
   only these checkboxes.  #1 below retrieves ALL checkboxes
   but I know there is a way to retrieve only the ones I need.
 
   Can some help me please.
 
   Thanks,
   gBerger
 
   #1
   This works [ and I was proud of myself for getting this far :)  ]
   //var sChkBoxes = $(form :checkbox).each(function()
   //{
   //alert(this.id);
   //}
   //);
 
   #2
   // NO ERROR JUST DOESNT RETURN ANYTHING
   //var s3 = ;
   //$(form :checkbox).find(a...@id*='ckKyW']).each(function()
   //{
   //alert(this.id);
   //}
   //);
 
   #3
   // ERRORS
   //$([...@id*='ckKyW']).each(function() {
   //alert(this.id);
   //}
   //);
   //$(a...@id*='ckKyW']).each(function() {
   //alert(this.id);
   //}
   //);
 
  --
  I have failed as much as I have succeeded. But I love my life. I love my
  wife. And I wish you my kind of success.




-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


  1   2   >