Re: [jQuery] Re: Traversing Help

2009-12-10 Thread Mauricio (Maujor) Samy Silva
Firebug points out the following:

1-) There is a missing (  

$(#test).click(function) {
should be:
$(#test).click(function () {

2-) and say more:

$detais is not defined.

Fix these issues

Regards

Maurício

  -Mensagem Original- 
  De: T.J. Simmons 
  Para: jQuery (English) 
  Enviada em: quinta-feira, 10 de dezembro de 2009 15:36
  Assunto: [jQuery] Re: Traversing Help


  Sorry, the right link is http://jsbin.com/ekuyo



Re: [jQuery] Superfish - content out of position

2009-12-10 Thread Mauricio (Maujor) Samy Silva
This isn't a jQuery issue.
This is a CSS issue.

Add the following:

table.blog {float:left;}
#footer {clear:both;}

Regards
Maurício

  -Mensagem Original- 
  De: luciano991 
  Para: jQuery (English) 
  Enviada em: quinta-feira, 10 de dezembro de 2009 16:20
  Assunto: [jQuery] Superfish - content out of position


  Hello,

  I am wondering why my superfish menu is pushing my content out of
  postion on this page:

  http://www.vtweb.com/joomla/perennialsantiques/

  Thanks,

  luciano

Re: [jQuery] Filtering on hidden contents

2009-12-08 Thread Mauricio (Maujor) Samy Silva
 Try this:

( $('.location div:visible').length == 0 ) ? $('.location').hide() : ''; 

Maurício
  De: wandrian 
  Para: jQuery (English) 
  Enviada em: segunda-feira, 7 de dezembro de 2009 23:21
  Assunto: [jQuery] Filtering on hidden contents


  I am trying to figure out if all the child divs of a containing div
  are hidden and if so I then want to hide the parent containing div.

  I am trying some thing like this:

  $('div.location').filter(function(){
  return (($this*:visible).length==0)
  }).hide();



Re: [jQuery] Change opacity for all divs except one

2009-12-05 Thread Mauricio (Maujor) Samy Silva
Hi Jared
The script is quite simply.
Study it.

jQuery:
(document).ready(function(){
 
 $('#thumbs div').click(function() {
$(this).find('img').css('opacity', 1);
$(this).siblings().find('img').css('opacity', 0.5);
 });
 
});

HTML:
div id=thumbs
diva href=#img src=1.jpg alt= //a/div
diva href=#img src=2.jpg alt= //a/div
diva href=#img src=3.jpg alt= //a/div
diva href=#img src=4.jpg alt= //a/div
diva href=#img src=5.jpg alt= //a/div
diva href=#img src=6.jpg alt= //a/div
/div

Hope this help you

Maurício
  -Mensagem Original- 
  De: Jared 
  Para: jQuery (English) 
  Enviada em: sexta-feira, 4 de dezembro de 2009 19:42
  Assunto: [jQuery] Change opacity for all divs except one


  Hello all,

  I have a bunch of thumb nails that will be at full opacity when a user
  gets to the page. Users will be able to select their favorite. What I
  want to have happen is when a user selects their first favorite all of
  the there thumbnails will be lowered in opacity then when they select
  other favorites the opacity of that thumbnail will be brought to full.
  Each thumbnail is in a div. I am at a complete lose on how I can
  achieve this. Any help is greatly appreciated. If you need anymore
  info just ask. Thanks ins advance!

Re: [jQuery] Ignoring click events in cells

2009-12-02 Thread Mauricio (Maujor) Samy Silva
Yes there is.

Query the event.target and do an if conditional like so:

$(tr).click(function(e) {

 // normalize e.target
 if (!e) var e = window.event;
 var tg = (window.event) ? e.srcElement : e.target;
 
   if ( tg.nodeName != INPUT  ) {
  alert($(this).attr(id));
   } else {
//do something
   }
 });

Regards
Maurício

  -Mensagem Original- 
  De: Andyk 
  Para: jQuery (English) 
  Enviada em: quarta-feira, 2 de dezembro de 2009 18:44
  Assunto: [jQuery] Ignoring click events in cells


  I have a table, which contains some data aswell as a checkbox:

  tr id=14373
   tdinput type=checkbox//td
   td.../td
   td.../td
  /tr
  Each row contains an id, and I want to call a function based on the
  click event:

  $(tr).click(function() {
  alert($(this).attr(id));
  });

  However, checking/unchecking the checkbox in each row also triggers
  the event. Is there anyway of preventing this?

Re: [jQuery] Re: Ignoring click events in cells

2009-12-02 Thread Mauricio (Maujor) Samy Silva
Thank you Scott
Maurício
  -Mensagem Original- 
  De: Scott Sauyet 
  Para: jQuery (English) 
  Enviada em: quarta-feira, 2 de dezembro de 2009 20:28
  Assunto: [jQuery] Re: Ignoring click events in cells


  On Dec 2, 5:20 pm, Mauricio \(Maujor\) Samy Silva
  css.mau...@gmail.com wrote:
   // normalize e.target
   if (!e) var e = window.event;
   var tg = (window.event) ? e.srcElement : e.target;

  jQuery does this normalization for you.  You can just use e.target

  (More info at http://docs.jquery.com/Events/jQuery.Event)

-- Scott

Re: [jQuery] Selector Help

2009-11-29 Thread Mauricio (Maujor) Samy Silva
Try this:

$('a.filter').click(function(){
  $(this).parent().siblings('li').removeClass('active');
  $(this).parent('li').addClass('active');
});

Maurício
  -Mensagem Original- 
  De: Charlie 
  Para: jquery-en@googlegroups.com 
  Enviada em: domingo, 29 de novembro de 2009 03:56
  Assunto: Re: [jQuery] Selector Help
  ...
  Dave Maharaj :: WidePixels.com wrote:
  How would I go about adding  class to the li in this set up?
   lia href=# class=filterspanall/span/a/li
  lia href=# class=filterspansome/span/a/li
  lia href=# class=filterspannone/span/a/li

  ...





Re: [jQuery] Re: slideToggle stops working after refreshing content with Ajax

2009-11-29 Thread Mauricio (Maujor) Samy Silva
jQuery 1.3 version introduces an event method called live() that resolves this 
issue.
Sice that version you don't need the *livequery plugin* never more.

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

Regards

Maurício
  -Mensagem Original- 
  De: Sala 
  Para: jQuery (English) 
  Enviada em: sábado, 28 de novembro de 2009 23:28
  Assunto: [jQuery] Re: slideToggle stops working after refreshing content with 
Ajax


  Thanks thanks so much

  I tried to rebind the event handlers  and for some reason that did not
  work.

  However, the plugin worked perfectly!

  Thanks once again, I spent days on this

  On Nov 28, 2:17 pm, jpcozart jeremy.coz...@gmail.com wrote:
   You can use the Live Query plugin to resolve this problem:
  
   http://docs.jquery.com/Plugins/livequery
  
   Or you can rebind the event handlers after the ajax call has updated
   the page. The new nodes do not have event handlers bound to them when
   they replace the old nodes:
  ...

[jQuery] Re: Converting rows into columns

2009-08-25 Thread Mauricio (Maujor) Samy Silva
I've provided a possible solution. It is hosted at:
http://jsbin.com/avowa/
http://jsbin.com/avowa/edit

Maurício
  -Mensagem Original- 
  De: Anush Shetty 
  Para: jquery-en@googlegroups.com 
  Enviada em: terça-feira, 25 de agosto de 2009 08:39
  Assunto: [jQuery] Converting rows into columns



  I am displaying a few fields in a table as below

  table
trtdfield1/td/tr
trtdfield2/td/tr
 trtdfield3/td/tr
  trtdfield4/td/tr
  trtdfield5/td/tr
  /table

  I have a link to append a new table with the same fields. What I would
  like to do is when I click on Append new table link, I would like to
  convert all the existing fields in the table in a single row instead
  of displaying them by columns. Can somebody give me some inputs on how
  I could go about implementing it

  -
  Anush

[jQuery] Re: jQuery selector for style attribute

2009-08-25 Thread Mauricio (Maujor) Samy Silva
Sintax for the selector is:

$('img[style=overflow: auto; width: 356px; height: 100px;]')

Maurício
  -Mensagem Original- 
  De: John 
  Para: jQuery (English) 
  Enviada em: terça-feira, 25 de agosto de 2009 14:36
  Assunto: [jQuery] jQuery selector for style attribute



  Hi,

  I want to select the following image using jQuery selector to see if I
  could use the style attribute,

  img id=ext-gen439 class=x-form-trigger x-form-arrow-trigger
  style=overflow: auto; width: 356px; height: 100px; src=images/
  s.gif/

  but seems the selector

  img[style=overflow: auto; width: 356px; height: 100px;]

  does not work at all. What would be the correct selector for the style
  attribute?

  Thanks in advance,

  John

[jQuery] Re: hide divs with float:left and show them again

2009-08-20 Thread Mauricio (Maujor) Samy Silva
When you remove a floated element from the flow of a document its position is 
occupied by the next float and this
causes the ruin! To preserve the space leaving by a removed div how about use:
css('visibility', 'hidden'); istead of show()

Maurício
  -Mensagem Original- 
  De: simusch 
  Para: jQuery (English) 
  Enviada em: quinta-feira, 20 de agosto de 2009 16:56
  Assunto: [jQuery] hide divs with float:left and show them again



  Hi

  I have a site with a lot of small div-boxes (with images and movies
  within them)
  they are positioned with CSS and float:left.

  i created buttons, which show and hide either all images or all movies
  this works well.

  but when i switch between these options, the float-position of the
  divs goes crazy and every div-container is on one line for itself
  (instead of 5 on one line)

  does someone have an idea, how i can solve this problem?

  simon

[jQuery] Re: Timeout

2009-08-15 Thread Mauricio (Maujor) Samy Silva
jQuery is JavaScript!
Use the regular JavaScript sintax
Maurício 
  -Mensagem Original- 
  De: shaf 
  Para: jQuery (English) 
  Enviada em: sábado, 15 de agosto de 2009 17:36
  Assunto: [jQuery] Timeout



  Hi Guys

  How do I set a timeout in jquery ? E.g. if a page is inactive for 20
  seconds a message pops up asking the user to refresh the page.

[jQuery] Re: Change the contents of a div after it has been created

2009-08-14 Thread Mauricio (Maujor) Samy Silva
var fAlt = $('.foo').attr('alt');

should be:

var fAlt = $('.foo a img').attr('alt');

or better

var fAlt = $(this).attr('alt');

Maurício
  -Mensagem Original- 
  De: Benn 
  Para: jQuery (English) 
  Enviada em: sexta-feira, 14 de agosto de 2009 18:37
  Assunto: [jQuery] Re: Change the contents of a div after it has been created
  missed a line, the JS should be:
  $('.foo').append('a href=#img src=1.gif class=1 alt=1st
  image //a');
  $('.foo a img').click(function(event){
  event.preventDefault();
  var fAlt = $('.foo').attr('alt');
  $('.fooAlt').text(fAlt)
  })

  ...

[jQuery] Re: Radio button checked status

2009-08-13 Thread Mauricio (Maujor) Samy Silva
There is nothing wrong with your code.
Have a look at this testcase: 
http://jsbin.com/igubi
http://jsbin.com/igubi/edit

Maurício

  -Mensagem Original- 
  De: littlerobothead 
  Para: jQuery (English) 
  Enviada em: quinta-feira, 13 de agosto de 2009 16:46
  Assunto: [jQuery] Radio button checked status



  Banging my head against a wall here. I have this:

  h3span class=num1/spanDate Range/h3
  pinput type=radio class=period name=period value=daily
  Daily/p
  pinput type=radio class=period name=period value=weekly
  Weekly/p
  pinput type=radio class=period name=period value=monthly
  Monthly/p

  and I'm trying to get checked status with this:

  var period = $('input.period:checked').val();

  But, of course, no joy. Do *I* need to set the checked status of the
  radio button in order to use the :checked method, or doesn't the
  browser handle this on it's own? I thought browsers changed the
  checked attribute on their own. I'm totally stumped and cranky over
  here.

  Thanks!
  -Nick

[jQuery] Re: table cells selector question

2009-07-13 Thread Mauricio (Maujor) Samy Silva
 $('td').click(function() {
  context = $(this).parents('table')[0];
  var cells = $('td.a', context);
 })
Maurício

  -Mensagem Original- 
  De: Brad 
  Para: jQuery (English) 
  Enviada em: segunda-feira, 13 de julho de 2009 16:39
  Assunto: [jQuery] table cells selector question



  I can do this to select all td's with a class of someclass

  var cells = $(td.someclass);

  My page my have more than one table so this would select all matching
  td's. What I need to do is isolate the selection to only the cells in
  the table where a row was clicked.

  I've tried

  var cells = $(td.someclass).filter(this.parents(table));

  but that is throwing an error w/in jQuery.



[jQuery] Re: Is there a more efficent way to write this script?

2009-07-10 Thread Mauricio (Maujor) Samy Silva
$( 'h3  a,   a', $(this) ).css('text-decoration', 'underline');

Maurício
  -Mensagem Original- 
  De: Jacques Choquette - WhistlerGraphicDesign.com 
  Para: jQuery (English) 
  Enviada em: sexta-feira, 10 de julho de 2009 10:33
  Assunto: [jQuery] Is there a more efficent way to write this script?




  $(this).children(h3).children(a).css(text-decoration,
  underline);$(this).children(a).css(text-decoration,
  underline);

  I am changing the css text decoration on A tags within H3 elements and
  also on child A tags is there not a way to bundle these together? so I
  would only have to write out the .css(text-decoration, underline);
  part once?



[jQuery] Re: Simple selector problem

2009-07-10 Thread Mauricio (Maujor) Samy Silva
Here it is returning 3 in IE and FireFox as expected.
Maurício
  -Mensagem Original- 
  De: Chris 
  Para: jQuery (English) 
  Enviada em: sexta-feira, 10 de julho de 2009 12:34
  Assunto: [jQuery] Simple selector problem



  $(document).ready(function {

  alert($(div).length);

  });

  --

  divdiv 1/div
  divdiv 2/div
  divdiv 3/div

  

  I'm using jQuery 1.3.2.  In IE, this returns 3.  In Firefox, it
  returns 4.

  What's going on?

[jQuery] Re: next index in Jquery

2009-07-03 Thread Mauricio (Maujor) Samy Silva

...selecting the next .slide after the one with .current in it? 

$('.current').next('.slide')
--
  how can i get the div index of the .current class?

var divIndex = $('#slideshow div').index(  $('.current')  ); 

Maurício
-
  -Mensagem Original- 
  De: Smickie 
  Para: jQuery (English) 
  Enviada em: sexta-feira, 3 de julho de 2009 11:18
  Assunto: [jQuery] next index in Jquery



  I was wondering if someone could please help me with a little Jquery.

  Does anyone know how i would go about selecting the next .slide after
  the one with .current in it? how can i get the div index of
  the .current class?

  div id=slideshow
  div class=slideSlide 1/div
  div class=slideSlide 2/div
  div class=slide currentSlide 3/div
  div class=slideSlide 4/div
  div class=slideSlide 5/div
  /div


  Ive got the action attached to somthing outside of the slideshow div
  so i can use .this.

  thanks very much.

[jQuery] Re: Selector :eq(x) issuing warning in FF

2009-07-02 Thread Mauricio (Maujor) Samy Silva
I run a local test with your code here and it works fine!
Maurício
  -Mensagem Original- 
  De: Shane Riley 
  Para: jQuery (English) 
  Enviada em: quinta-feira, 2 de julho de 2009 13:12
  Assunto: [jQuery] Selector :eq(x) issuing warning in FF



  When calling this jQuery:

  $(#homepage-slides img:eq(0)).fadeOut(300, function() {
  $(#homepage-slides img:eq(1)).fadeIn(300, function() { $(#homepage-
  slides img:eq(0)).remove(); });
  });

  I'm getting this warning in the Web Developer toolbar in Firefox:

  Warning: Unknown pseudo-class or pseudo-element 'eq'.

  It seems to work, however the image preload function I'm calling just
  before it isn't functioning and I'm thinking it's because of this
  issue. I'm using jQuery 1.3.2. Is there a different syntax to do this
  now? If so, then the docs demo is incorrect.

[jQuery] Re: slideToggle jump issue

2009-06-26 Thread Mauricio (Maujor) Samy Silva
Hi Alexandre
Thanks for your kindness reply
Sorry but this isn't the well know padding - margin jump issue [1].
Have a closest look at the sources of my live examples and you will see,
as I pointed out on my OP, that the issue comes from the widht.
PS: The examples don't use paddings or margins

[1]   http://jqueryfordesigners.com/animation-jump-quick-tip/

Regards
Maurício


  -Mensagem Original- 
  De: Alexandre Magno 
  Para: jQuery (English) 
  Enviada em: sexta-feira, 26 de junho de 2009 14:43
  Assunto: [jQuery] Re: slideToggle jump issue



  Hello Maujor,

  First of all, I'm your big fan...

  I had this problema a lot of times, sometimes in one browser, another
  time in others, Wich browser the problem came from?

  My problem was always because of padding, it seens that slideToggle
  doesn't consider the padding... so everytime the amount of jump was
  relative to padding size. So I didint find the right thing to solve
  the problem, but I take out the padding via javascript before call
  slideToggle and then give the same padding again in callback, this
  solve to me... not a ideal solution, but mabe it can help...

  Alexandre Magno
  Interface Developer
  http://blog.alexandremagno.net

  On Jun 26, 1:28 pm, Maujor css.mau...@gmail.com wrote:
   I have the same slideToggle effect in two slightly differents scenarios.
   Scenario #1 - There is a CSS rule setting with:700px for the whole scenario.
   Scenario #2 - There isn't a CSS rule for the width, so it defaults to 100%
   width.
  
   Issue: In scenario #2 all works fine. But, in scenario #1 the animation ends
   with a little jump.
   PS: If you resizes the window to a width less than 700px it works fine!
  
   Are there a fix or is this a bug?
  
   Live examples:
   scenario #1 http://jsbin.com/adavu/ 
   scenario #2 http://jsbin.com/etoli/ 
  
   TIA
  
   -
   Maurício Samy Silva
   --
   View this message in 
context:http://www.nabble.com/slideToggle-jump-issue-tp24223386s27240p2422338...
   Sent from the jQuery General Discussion mailing list archive at Nabble.com.

[jQuery] Re: Toggle Text

2009-06-25 Thread Mauricio (Maujor) Samy Silva
Add the following to your script:

 if ( $(this).is(':checked') ) {
   $('#CheckAll').html('Uncheck All');
} else {
   $('#CheckAll').html('Check All');
}
 Maurício

  -Mensagem Original- 
  De: evanbu...@gmail.com 
  Para: jQuery (English) 
  Enviada em: quinta-feira, 25 de junho de 2009 13:12
  Assunto: [jQuery] Toggle Text



  Hi

  I'm using this to check/uncheck a group of checkboxes which works
  fine.  However, when all of checkboxes are checked, I would like the
  span id=CheckAll to read Uncheck All and to toggle back to Check
  All when all of the boxes are unchecked.

  script src=js/jquery-1.3.2.min.js type=text/javascript/script
  script type=text/javascript
  $(document).ready(function() {
  $('#chkAll').click(
   function() {
  $(INPUT[type='checkbox']).attr('checked', $
  ('#chkAll').is(':checked'));
  });
   });
  /script

  tr
  tdinput name=chkAll id=chkAll type=checkbox Checked //td
  td class=style2emstrongspan id=CheckAllCheck All/span/
  strong/em/td
  /tr

  Thanks

[jQuery] Re: jquery adding and removing row

2009-06-25 Thread Mauricio (Maujor) Samy Silva
The following block of code isn't working:

newo.find('.remove').click(function () {
newo.remove();
alert('hel');
});

It should be:

$('.remove').click(function () {
$(this).parents('tr').remove();
});

Addicionaly check the sintaxe for:

.item :last

should be:

.item:last (without a blank space in between)

Maurício


  -Mensagem Original- 
  De: introvert 
  Para: jQuery (English) 
  Enviada em: quinta-feira, 25 de junho de 2009 14:04
  Assunto: [jQuery] jquery adding and removing row



  Hello,

  I want to be able to add row at the end of the table with a 'remove'
  link which will remove specific row.



[jQuery] Re: show/hide positioned to its trigger

2009-06-24 Thread Mauricio (Maujor) Samy Silva
$('tr td:first-child').attr('align', 'value_here');
Maurício
  -Mensagem Original- 
  De: roxstyle 
  Para: jQuery (English) 
  Enviada em: quarta-feira, 24 de junho de 2009 14:17
  Assunto: [jQuery] show/hide positioned to its trigger



  i am trying to learn how to position a show/hide module to the a
  that triggers it, instead of a literal positioning through css

  this is a sample of the module i am trying to position.
  http://www.roxstyle.com/projects/blssi/cms/de-tool/proj-distribution.html

  instead of setting the css margins and paddings to the doc space, i
  would like to set the object relative to the cell where the trigger
  exists.
  can anyone point me in the direction of tutorials or samples of this
  behavior?

[jQuery] Re: multiply 2 input fields on change

2009-06-24 Thread Mauricio (Maujor) Samy Silva

Live example at:  http://jsbin.com/ahiyo/

Edit at: http://jsbin.com/ahiyo/edit

Maurício
  -Mensagem Original- 
  De: efet 
  Para: jQuery (English) 
  Enviada em: quarta-feira, 24 de junho de 2009 18:03
  Assunto: [jQuery] multiply 2 input fields on change



  Hi,

  I have three input fields as UNITPRICE  UNITQUANTITY and TOTALPRICE.
  UNITPRICE's value depends on a product chosen in the preceding tab.
  Now, I want UNITPRICE  UNITQUANTITY fields multiplied and result
  shown on TOTALPRICE input field. How can I do it?

[jQuery] Re: slide a div open and closed

2009-06-23 Thread Mauricio (Maujor) Samy Silva
I've hosted a live example for the effect at: http://jsbin.com/irera/

Edit it at:  http://jsbin.com/irera/edit 

Maurício
  -Mensagem Original- 
  De: webguy262 
  Para: jquery-en@googlegroups.com 
  Enviada em: terça-feira, 23 de junho de 2009 09:37
  Assunto: [jQuery] slide a div open and closed

  I need to create and effect just like what happens when you mouse over the
  Check Availability link on this site:

  http://www.claridges.co.uk/



[jQuery] Re: Removing an emptied paragraph from the DOM

2009-06-20 Thread Mauricio (Maujor) Samy Silva
How about?

$('.buggybox').next('p').remove();

Maurício
  -Mensagem Original- 
  De: Bruce MacKay 
  Para: jquery-en@googlegroups.com 
  Enviada em: sábado, 20 de junho de 2009 08:20
  Assunto: [jQuery] Removing an emptied paragraph from the DOM


  Hello folks,

  I have an application which removes an image from within a paragraph, wraps 
that image in a div and places it in front of the paragraph.

  I now want to remove that paragraph.

  Why doesn't the following use of remove() not achieve my objective?  I've 
tested the length - it is 0, yet the remove doesn't happen.

  Thanks, Bruce


  var parnt = $(this).parent();//the parent p tag containing the 
image to be processed
  $(this).insertBefore(p).wrap(div class='buggybox clearfix' id='g + i 
+'/div);

  if (parnt.length=0) {
   parnt.remove();
  } 

[jQuery] Re: jQuery text toggle effect

2009-06-19 Thread Mauricio (Maujor) Samy Silva
Please:
1-) Wrap Show within a span element.
2-) Get rid of the style atributte for the ul. ul's are block level elements by 
default.

div class=showhide
spanShow/span
ul class=clients
li/li
...

3-) And here goes the code;

$(.showhide).click(function() {
$(this).children(.clients).slideToggle('slow');
  var currentText = $('span', '.showhide').text() 
if (currentText == 'Hide') { 
   $('span', '.showhide').html('Show') 
   } else { 
  $('span', '.showhide').html('Hide') }  
});

Maurício


  -Mensagem Original- 
  De: mojoeJohn 
  Para: jQuery (English) 
  Enviada em: sexta-feira, 19 de junho de 2009 11:02
  Assunto: [jQuery] jQuery text toggle effect



  So i was looking on here yesterday, and i've been scouring the Web for
  a simple text toggle tutorial. I haven't been able to find one --
  maybe i'm not looking in the right places, but anyway. so you can
  probably tell what i'm trying to achieve just by my subject line.

  I have a div of images called .clients wrapped in a div
  called .showhide

  div class=showhide
  Show
  ul class=clients style=display: block;
  li/li
  li/li
  li/li
  li/li
  li/li
  noscriptThis is the description for the logo/noscript
  /ul
  /div


  here's the jQuery that runs when i click .showhide

  $(.showhide).click(function(){
$(this).children(.clients).slideToggle('slow');
  });


  just a simple slideToggle of the images on the click of the .showhide
  class. nothing new there.

  i tried a couple of things, but i don't know enough about jQuery yet
  to do this correctly.
  the best i could do was to have the text change after i
  click .showhide, but then the .slideToggle became disabled after the
  text changed.

  obviously, i want the text to toggle the words show and hide in
  accordance to the slide toggle.

  i have a hunch that i need to write an if/then statement using
  the .html feature to change the text itself and maybe even a variable
  for the show and a variable for the hide so i can pass them through
  with ease.

  can anyone help me?! am i on the right track?!


  thanks,

  John

[jQuery] Re: First Parent Siblings

2009-06-17 Thread Mauricio (Maujor) Samy Silva
Try:
$(this).parent().next().toggle();
Maurício

  -Mensagem Original- 
  De: FrenchiINLA 
  Para: jQuery (English) 
  Enviada em: quarta-feira, 17 de junho de 2009 18:16
  Assunto: [jQuery] First Parent Siblings



  I have several following html code:
  h3a class=classa/a/h3div class=classdiv/div
  h3a class=classa/a/h3div class=classdiv/div
  h3a class=classa/a/h3div class=classdiv/div
  etc
  I would like toggle div.classdiv when a.classa is clicked

  I tried $(this).parent('h3').siblings('div.classdiv').toggle();
  but all div all toggled. Any help would be greatly appreciated

[jQuery] Re: Get first element when there are multiple classes

2009-06-16 Thread Mauricio (Maujor) Samy Silva
I am not sure on what are you trying to do, but

alert($(#ulList .liEven:first).attr(class)); /* Returns Success*/

Maurício


  -Mensagem Original- 
  De: Dave 
  Para: jQuery (English) 
  Enviada em: terça-feira, 16 de junho de 2009 09:57
  Assunto: [jQuery] Get first element when there are multiple classes



  Hi

  How do you get the first element when the element got multiple
  classes?

  ul id=ulList
  li class=liRow1/li
  li class=liRow liEven2/li
  li class=liRow3/li
  li class=liRow liEven4/li
  /ul
  input id=btSave type=button value=Save /

  $(#btSave).click(function(event) {
  alert($(#ulList .liRow:first).attr(class));/* Success */
  alert($(#ulList .liRow .liEven:first).attr(class));/* Hmm
  */
  });

  Cheers

[jQuery] Re: :eq versus eq()

2009-06-10 Thread Mauricio (Maujor) Samy Silva
Good point Pierre!
Well noted. TKS.
Any others possible differences?
Maurício
  -Mensagem Original- 
  De: Pierre Bellan 
  Para: jquery-en@googlegroups.com 
  Enviada em: quarta-feira, 10 de junho de 2009 13:25
  Assunto: [jQuery] Re: :eq versus eq()


  With the traversing method, you can match a set of elements then select, for 
example, the third one


  $('.myclass,#myid').eq(2)


  I didn't use the traversing method but i think that is one of possible usage


  Pierre


  2009/6/10 Maujor css.mau...@gmail.com



According jQuery documentation  [1][2]
:eq returns Array Element and eq() returns one jQuery object.
What does means Array Element? It is a single element?
By the other hand eq() = Reduce the set of matched elements to a single
element.
So, both returns a single element and it seems to me that there isn't any
difference between :eq and eq().
Is one faster than the other?
Why are there two sintaxes to achieve the same task? Or am I missing
sometghing?

[1] http://docs.jquery.com/Selectors
[2] http://docs.jquery.com/Traversing

-
Maurício Samy Silva
--
View this message in context: 
http://www.nabble.com/%3Aeq-versus-eq%28%29-tp23962849s27240p23962849.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.





[jQuery] Re: Find text (nodes) within an element?

2009-06-10 Thread Mauricio (Maujor) Samy Silva
$(document).ready(function(){
 var string = $.trim( $('label').text() )
 var lastIndex = string.length - 1
 if ( string.charAt(lastIndex) == F ) {
 alert('BINGO!')
 } else {
 alert('FAIL!')
}
});
 Maurício
  -Mensagem Original- 
  De: ldexterldesign 
  Para: jQuery (English) 
  Enviada em: quarta-feira, 10 de junho de 2009 19:24
  Assunto: [jQuery] Find text (nodes) within an element?

  Easy guys,
  labelA B C D E F/label
  Anyone got any tips on how to find out if the last letter of my label
  is 'F'?
  Cheers,
  L

[jQuery] Re: same effect on multiple objects with same id

2009-06-09 Thread Mauricio (Maujor) Samy Silva
Why not use a class instead of an id in order to target all buttons?

Or alternatively something like:

 $('img[alt=button]').hover(
  function () {
$(this).fadeTo('fast', .10);
  },
  function () {
$(this).fadeTo('fast', 1.0);
  }
);
Maurício


  -Mensagem Original- 
  De: simon 
  Para: jQuery (English) 
  Enviada em: terça-feira, 9 de junho de 2009 07:56
  Assunto: [jQuery] same effect on multiple objects with same id



  I basically have several buttons that are created dynamically via a
  db, so I can have 1 to 40 etc.
  now at the moment I give each one a unique id and a hover code in the
  loops. see below:

  loops goes here..

  img src=button.jpg alt=button  border=0 id=myButton?=
  $newCode ? /
  $(document).ready(function(){

  $(#myButton?=$newCode ?).hover(
function () {
  $(this).fadeTo('fast', .50);
},
function () {
  $(this).fadeTo('fast', 1.0);
}
  );
  });

  end loop

  this works fine but gives me a lot of jquery code as well for each as
  i also have a click action after it, but thats another matter, what i
  am after is if i just give it the same id as below  then i would like
  only to have one hover code that would do the effect to all, but at mo
  it will only do the effect to the first, any ideas?

  loops goes here..
  img src=button.jpg alt=button  border=0 id=myButton/
  end loop

  So only this loops and i only need the code below once.

  $(document).ready(function(){
  $(#myButton).hover(
function () {
  $(this).fadeTo('fast', .50);
},
function () {
  $(this).fadeTo('fast', 1.0);
}
  );
  });


  Many thanks Si

[jQuery] Re: Remove links but not images

2009-06-09 Thread Mauricio (Maujor) Samy Silva
1-) The dirty way:

$('ul li a').removeAttr('href')

2-) A standard way:

 image = [];
 $('ul li a img').each(function(i) {
 image[i] = $(this).clone();
 $(this).parents('li').html(image[i]);
 })

Maurício



  On Tue, Jun 9, 2009 at 2:13 PM, alex alex_bille...@hotmail.com wrote:


Hi folks

This has me stumped. I have a list of images and I want to remove the
links but retain the images.

So this

ul
lia href=fooimg src=path/to/image1 //a/li
lia href=fooimg src=path/to/image2 //a/li
etc etc
/ul

Becomes this

ul
liimg src=path/to/image1 //li
liimg src=path/to/image2 //li
/ul

Using this

$('ul a').remove();


does not work as it also removes the images as well.

Any help would be much appreciated. Thanks in advance.

Alex





  -- 
  Armand Datema
  CTO SchwingSoft


[jQuery] Re: Selecting previous element

2009-06-08 Thread Mauricio (Maujor) Samy Silva
$('#mynav li.current').prev().css('blackground', 'black');
Maurício
  -Mensagem Original- 
  De: Alex 
  Para: jQuery (English) 
  Enviada em: segunda-feira, 8 de junho de 2009 20:04
  Assunto: [jQuery] Selecting previous element



  How do I apply a class to the previous element that's being hovered?
  Basically the opposite to the following CSS selector:

  #mynav li.current + li {
  background:black;
  }

  Which would make the li next to the one with a class of 'current' have
  a black background. Effectively something like:

  #mynav li.current - li {
  background:black;
  }

  Which would do the same, but to the element immediately before this
  one. This is impossible with CSS, how would I select it using jQuery?

  Many thanks,
  Alex

[jQuery] Re: JQuery DatePicker Plugin

2009-06-05 Thread Mauricio (Maujor) Samy Silva
Set in options:

dateFormat: mm dd yy

Maurício
  -Mensagem Original- 
  De: Bluesapphire 
  Para: jQuery (English) 
  Enviada em: sexta-feira, 5 de junho de 2009 12:04
  Assunto: [jQuery] JQuery DatePicker Plugin



  Hi!
 Iam using JQuery DatePicker Plugin , created by Kelvin Luck (http://
  www.kelvinluck.com/).

  Plugins default format is d/m/Y.  Can someone guide me how to change
  its default format to US Date format (m/d/Y).


  Thanks in advance

[jQuery] Re: Selectors only matching first element

2009-06-04 Thread Mauricio (Maujor) Samy Silva

There isn't in HTML Specs a true value for checked attribute.
Try:
$(input:checkbox).attr(checked, checked);
Maurício
  -Mensagem Original- 
  De: matt 
  Para: jQuery (English) 
  Enviada em: quinta-feira, 4 de junho de 2009 18:12
  Assunto: [jQuery] Selectors only matching first element
  ...
  $(input:checkbox).attr(checked, true);

  checks the first box only.



[jQuery] Re: Selectors only matching first element

2009-06-04 Thread Mauricio (Maujor) Samy Silva
This works here!
Have a look at: http://jsbin.com/awapu/edit
Maurício
  -Mensagem Original- 
  De: matt 
  Para: jQuery (English) 
  Enviada em: quinta-feira, 4 de junho de 2009 19:35
  Assunto: [jQuery] Re: Selectors only matching first element



  Thanks.  Unfortunately this doesn't seem to work either.  The div
  example from the page should work as it was copied directly, but it
  doesn't.  This is bizarre.

  If it helps, I have the tablesorter, validate and maybe even UI
  plugins set up here as well.. could one of them be interfering?

  On Jun 4, 6:26 pm, Mauricio \(Maujor\) Samy Silva
  css.mau...@gmail.com wrote:
   There isn't in HTML Specs a true value for checked attribute.
   Try:
   $(input:checkbox).attr(checked, checked);
   Maurício
   -Mensagem Original-
   De: matt
   Para: jQuery (English)
   Enviada em: quinta-feira, 4 de junho de 2009 18:12
   Assunto: [jQuery] Selectors only matching first element
   ...
   $(input:checkbox).attr(checked, true);
  
   checks the first box only.

[jQuery] Re: Selector not question

2009-06-04 Thread Mauricio (Maujor) Samy Silva

  -Mensagem Original- 
  De: Dave Maharaj :: WidePixels.com 
  Para: jquery-en@googlegroups.com 
  Enviada em: quinta-feira, 4 de junho de 2009 21:43
  Assunto: [jQuery] Selector not question


  I am trying to disable all links except for the one clicked.

  $('a[class^=edit_]').click(function(){
   var url_id = $(this).attr('href');
   var e = $(this).attr('class');
   var x = $(this).attr('id').split('_');
   var y = x[0];
   var z = x[1];
   alert(e);

  the alert shows edit_profile so e = edit_profile 

  so i am trying to fade all classes with edit_ somethingto 0.25 except for 
edit_profile but its not working.

  What am I missing?


  $('a[class^=edit_]:not(e)').fadeTo('slow' , 0.25 , function() {
  
  
  
  }):

  Thanks

  Dave

[jQuery] Re: Selector not question

2009-06-04 Thread Mauricio (Maujor) Samy Silva
$('a[class^=edit_]:not(.' + e + ')').fadeTo('slow' , 0.25 , function() {
...
}

Maurício
  -Mensagem Original- 
  De: Dave Maharaj :: WidePixels.com 
  Para: jquery-en@googlegroups.com 
  Enviada em: quinta-feira, 4 de junho de 2009 21:43
  Assunto: [jQuery] Selector not question


  I am trying to disable all links except for the one clicked.

  $('a[class^=edit_]').click(function(){
   var url_id = $(this).attr('href');
   var e = $(this).attr('class');
   var x = $(this).attr('id').split('_');
   var y = x[0];
   var z = x[1];
   alert(e);

  the alert shows edit_profile so e = edit_profile 

  so i am trying to fade all classes with edit_ somethingto 0.25 except for 
edit_profile but its not working.

  What am I missing?


  $('a[class^=edit_]:not(e)').fadeTo('slow' , 0.25 , function() {
  
  
  
  }):

  Thanks

  Dave

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-03 Thread Mauricio (Maujor) Samy Silva
 On Wed, Jun 3, 2009 at 11:20 AM, BigAB adamlbarr...@gmail.com wrote:

  have you tried
  var myText = $('#knowndiv').parents('tr').find('td:first').text();
  alert(myText);

  The TR is really the parent of the TDs, not the table.

For information only.
I've used parents() not parent().
parents() means ancestor and table is ancestor of TDs

See: http://docs.jquery.com/Traversing

Maurício
-
  -Mensagem Original- 
  De: Ricardo 
  Para: jQuery (English) 
  Enviada em: quarta-feira, 3 de junho de 2009 15:15
  Assunto: [jQuery] Re: text of first sibling of a parent...How do I get it



  There is no reason why you shouldn't get this working with one of the
  examples provided. For the nesting issue, filter with :first:

  $('#knowndiv').parents('tr:first').children('td:first').text();

  parents(xx:first) is similar to closest(xx), only the latter will also
  try to match the element itself.

  On Jun 3, 1:01 pm, jake dimano jakedim...@gmail.com wrote:
   Yes, that is the first thing I did, to no avail. I think all I am
   left with just trudging through this with pure javascript.
   jake
  
   On Wed, Jun 3, 2009 at 11:20 AM, BigAB adamlbarr...@gmail.com wrote:
  
have you tried
var myText = $('#knowndiv').parents('tr').find('td:first').text();
alert(myText);
  
The TR is really the parent of the TDs, not the table.
  
On Jun 3, 7:33 am, jake dimano jakedim...@gmail.com wrote:
Mauricio, your code basically works fine on a simple test page. But
there is something about my set-up that makes the bit about
  ...

[jQuery] Re: LI:last of submenu's

2009-06-02 Thread Mauricio (Maujor) Samy Silva
Use 
$('ul#sidebarmenu1 ul li:last-child a').css('background-image', 'none');

:last = Matches ONLY  the last selected element.
last-child = Matches ALL elements that are the last child of their parent.

Maurício

  -Mensagem Original- 
  De: josb...@gmail.com 
  Para: jQuery (English) 
  Enviada em: terça-feira, 2 de junho de 2009 10:01
  Assunto: [jQuery] LI:last of submenu's



  I don't want background-image's on all the last list-items of a
  submenu.
  I use this code but it only apply the edit to the last submenu.
  $('ul#sidebarmenu1 ul li:last a').css('background-image', 'none');
  How can i apply this to all submenu's?


[jQuery] Re: fadeIn() on elements with alpha filter not working properly in IE

2009-06-02 Thread Mauricio (Maujor) Samy Silva
Reset the opacity to IE when fading in the element like so:

  -Mensagem Original- 
  De: Luch Univision 
  Para: jQuery (English) 
  Enviada em: terça-feira, 2 de junho de 2009 14:46
  Assunto: [jQuery] fadeIn() on elements with alpha filter not working properly 
in IE



  I am running into an effect issue with IE only. ...
  -moz-opacity:.8; opacity:0.80; filter:alpha(opacity=80);
  ...
  I saw some people that had posted similar questions but without answers:

  
http://groups.google.com/group/jquery-en/browse_thread/thread/51e149642787e846/424497df76ec88ad


[jQuery] Re: fadeIn() on elements with alpha filter not working properly in IE

2009-06-02 Thread Mauricio (Maujor) Samy Silva
Sorry for the previous post.Hit send early :-(

Reset the opacity to IE when fading in the element like so:

$('elementToFade').css('filter','alpha(opacity=80)').fadeIn();

Maurício
-Mensagem Original- 
De: Luch Univision 
Para: jQuery (English) 
Enviada em: terça-feira, 2 de junho de 2009 14:46
Assunto: [jQuery] fadeIn() on elements with alpha filter not working 
properly in IE



I am running into an effect issue with IE only. ...
-moz-opacity:.8; opacity:0.80; filter:alpha(opacity=80);
...
I saw some people that had posted similar questions but without answers:


http://groups.google.com/group/jquery-en/browse_thread/thread/51e149642787e846/424497df76ec88ad


[jQuery] Re: tilde (~) selector

2009-06-02 Thread Mauricio (Maujor) Samy Silva
Yes, it appear to be a 1.3.2 jQuery version bug.
Take a look at test cases:

Version 1.3.1 working: http://jsbin.com/usidi/edit

Version 1.3.2 doesn't working: http://jsbin.com/upapu/edit

Maurício
  -Mensagem Original- 
  De: Jakub Suder 
  Para: jQuery (English) 
  Enviada em: terça-feira, 2 de junho de 2009 16:05
  Assunto: [jQuery] Re: tilde (~) selector



  I've checked in multiple browsers using browsershots.org, and only the
  ones from Opera 10 and Firefox 3.1 were OK, the rest were broken
  (example: Firefox 3.0: http://dl.getdropbox.com/u/41808/ff3win.png).

  It looks like this might be the answer: 
http://osdir.com/ml/jquery-dev/2009-03/msg00185.html
  (although apparently it wasn't fixed since March - it still breaks in
  my Firefox on jquery-nightly (jquery-1.3.1 works, 1.3.2 doesn't).

  JS

[jQuery] Re: tilde (~) selector

2009-05-29 Thread Mauricio (Maujor) Samy Silva
It does. It returns b and d as expected!

Try:
$('p ~ p').css('color', 'red')
and b and d will be red

Maurício
  -Mensagem Original- 
  De: Jakub Suder 
  Para: jQuery (English) 
  Hi,
  I...
  html
headscript src=http://code.jquery.com/jquery-latest.js;/
  script/head
body
  pa/p
  pb/p
  divc/div
  pd/p
/body
  /html

  ..
   But $
  ('p ~ p') doesn't return anything... I
  ...

[jQuery] Re: tilde (~) selector

2009-05-29 Thread Mauricio (Maujor) Samy Silva
Well,  I've tested here and works fine in IE6, IE7, Firefox 3.0.10, Opera 9.64, 
Safari on Windows.
Have a closest look at your test case.
Maurício
  -Mensagem Original- 
  De: Jakub Suder 
  Para: jQuery (English) 
  Enviada em: sexta-feira, 29 de maio de 2009 11:32
  Assunto: [jQuery] Re: tilde (~) selector



  On 29 Maj, 16:10, Mauricio \(Maujor\) Samy Silva
  css.mau...@gmail.com wrote:
   It does. It returns b and d as expected!
  
   Try:
   $('p ~ p').css('color', 'red')
   and b and d will be red

  I've just noticed that it works in Safari (4 beta), but not in Firefox
  (3)... this isn't normal, is it? :|

  JS

[jQuery] Re: not Filter

2009-05-28 Thread Mauricio (Maujor) Samy Silva
And the complement to $('foo').is() is !$('foo').is()
Maurício 
  -Mensagem Original- 
  De: Richard D. Worth 


  .is() and .not() are not complementary. See:

  http://docs.jquery.com/Traversing/is#expr

  is( expr )Returns: Boolean
  Checks the current selection against an expression and returns true, if at 
least one element of the selection fits the given expression.

  http://docs.jquery.com/Traversing/not#expr

  not( expr )Returns: jQuery
  Removes elements matching the specified expression from the set of matched 
elements.

  The complement to .not() is .filter().

  - Richard


  On Thu, May 28, 2009 at 5:32 AM, Alaa ala...@gmail.com wrote:


I wrote a simple code to test the is and not filters, like this:

Script:
 $(#isDiv div).click(function (){
 if ($(this).is(:contains('Offenburg'))) {
 alert(Offenburg);
  }

 if ($(this).not(:contains('Offenburg'))) {
 alert(Not Offenburg);
  }
 });



[jQuery] Re: $(#selectInput).val()

2009-05-28 Thread Mauricio (Maujor) Samy Silva
 Try:
 ...
var selector = $('#selectList');
selector.change(function() {
var directory = $('option[selected]').text(); // if you want get the option text

or

var directory = $('option[selected]').attr('id'); // if you want get the option 
id
...

  -Mensagem Original- 
  De: Y vd Bogert 




  In my html select code i've got the following options:
  select name=dir id=selectList
option id=introductieintroductie/option
option id=offertesoffertes/option
  /select

  But when i select offertes it always shows my value as introductie?

  ...
  var selector = $('#selectList');
  selector.change(function() {
var directory = selector.val();
  ...

[jQuery] Re: selecting next()'s until I reach a tag

2009-05-27 Thread Mauricio (Maujor) Samy Silva
Try:
$('h5').nextAll('p');

Maurício
  -Mensagem Original- 
  De: Andy 
  Para: jQuery (English) 
  Enviada em: quarta-feira, 27 de maio de 2009 14:11
  Assunto: [jQuery] selecting next()'s until I reach a tag



  Is there a way for me to add the next several blocks until I get to a
  specific tag?



[jQuery] Re: selecting next()'s until I reach a tag

2009-05-27 Thread Mauricio (Maujor) Samy Silva
Please have a look at: 
http://docs.jquery.com/JQuery_1.2_Roadmap#.nextUntil.28.29_.2F_.prevUntil.28.29
Maurício

  -Mensagem Original- 
  De: Andy 
  Para: jQuery (English) 
  Enviada em: quarta-feira, 27 de maio de 2009 14:32
  Assunto: [jQuery] Re: selecting next()'s until I reach a tag
  Thanks for the suggestion!
  That sort of works, but it's also getting the p tags AFTER the next
  H5, and I don't want it to.

  On May 27, 1:24 pm, Mauricio \(Maujor\) Samy Silva
  css.mau...@gmail.com wrote:
   Try:
   $('h5').nextAll('p');
  
   Maurício


[jQuery] Re: number of checked boxes

2009-05-26 Thread Mauricio (Maujor) Samy Silva
Or... you could use a shorter selector

var checked = $(':checkbox:checked').length;
  -Mensagem Original- 
  De: Macsig 
  Para: jQuery (English) 

  Thanks for your help.
  I appreciate it

  On May 26, 2:44 pm, James james.gp@gmail.com wrote:

   var checked = $(input[type=checkbox]:checked).length;
  
   if (checked = 1) {
   // do something
  
   }


[jQuery] Re: Apply or remove style - Not workingin IE versions

2009-05-24 Thread Mauricio (Maujor) Samy Silva
Would you please provide a sample for your HTML markup? 
Maurício
  -Mensagem Original- 
  De: Dave Maharaj :: WidePixels.com 

  Not working in IE at all. Works in FF but noting in IE 5.5 to 7
  $('#resume_education dl:first').addClass('first_entry');



[jQuery] Re: AJAX issue

2009-05-09 Thread Mauricio (Maujor) Samy Silva


-Mensagem Original- 
De: Connor con...@letsbeglobal.com


...

item
content:encoded![CDATA[p
Some text
/p
]]/content:encoded
/item



How would I go about targeting the p tag or the content inside?

---
Try:
 $(xml).find('content:encoded').each(function(){
  var text = $(this).text();

Maurício 



[jQuery] Re: AJAX Problem

2009-05-08 Thread Mauricio (Maujor) Samy Silva




Awesome, Mauricio had the right solution. I had figured that e was
working on the link, but now that I think about it, that makes no
sense. So that works, now I have to figure out how to inject the
incoming html, because apparently that's not working, just not sure
yet if it's my javascript or my PHP (I'm working with CakePHP).

---
It appear that there is nothing wrong with the jQuery sintax.
Does you made what Arak pointed?

method: 'get'
should be:
type: 'get'

Maurício



[jQuery] Re: AJAX Problem

2009-05-08 Thread Mauricio (Maujor) Samy Silva


De: Arak Tai'Roth nielsen.dus...@gmail.com
Okay, so correction, I got it, it was a dumb mistake, makes me thing I
should go back to high school to learn how to spell.

Anyways, while I'm here, is there anyway I can force the callback
function beforeSend to run for a certain amount of seconds before to
stops running? Essentially what I want is to force the loading
animation I have going to run for at least 3 seconds or so before the
content loads, so it doesn't give a seizure inducing flash while 3
things happen all at once because the content loads too fast.

---
Use the standard JavaScript method setTimeout
Maurício 



[jQuery] Re: AJAX Problem

2009-05-07 Thread Mauricio (Maujor) Samy Silva


-Mensagem Original- 
De: Arak Tai'Roth nielsen.dus...@gmail.com


... Here is my code:


$(document).ready(function(){
$('#events_box a.ajax_replace').click(function(e){
e.preventDefault();
$('.news_border').slideUp('slow');

$.ajax({
method: 'get',
url: e.attr('href'),
data: { 'do' : '1' },

...
-
You are catching the URL for request in a wrong way.
There isn't an object  *e.attr('href')*
Try this:
$(document).ready(function(){
$('#events_box a.ajax_replace').click(function(e){
e.preventDefault();

var url = $(this).attr('href');== add

$('.news_border').slideUp('slow');

$.ajax({
method: 'get',
url: url,== modified
data: { 'do' : '1' },
...

Maurício 



[jQuery] Re: Ajax timeout doesn't call error function?

2009-04-20 Thread Mauricio (Maujor) Samy Silva



Hi!
I'm trying to setup an ajax call which throws an error on timeout.

...

timeout: 1,
error: function(d,msg) {
 alert(Could not load stuff);
 },

...

This works, but the error is never thrown. If I change the URL to
something that's broken, I do get the error message, but on timeout it
never happens.

---
Are you sure that your request spends more than 10s ?

Maurício




[jQuery] Re: Ajax timeout doesn't call error function?

2009-04-20 Thread Mauricio (Maujor) Samy Silva
A timeout is not considered an error.

No. It's an error.

Do the following:

timeout: 1,
error: function(d,msg) {

if (msg==timeout) {
alert(Ops! Could not load stuff - A timedout error occur);
} else {   
alert(Could not load stuff  - Another errorType occur);
},
...

Maurício
  -Mensagem Original- 
  De: Martijn Houtman 
  Para: jquery-en@googlegroups.com 
  Enviada em: segunda-feira, 20 de abril de 2009 10:47
  Assunto: [jQuery] Re: Ajax timeout doesn't call error function?


  Hey PanMan,


  On Apr 20, 2009, at 12:28 PM, PanMan wrote:


This works, but the error is never thrown. If I change the URL to

something that's broken, I do get the error message, but on timeout it

never happens.

Am I doing anything wrong? Or is this a bug somewhere?



  No, this is not a bug. A timeout is not considered an error. You'd be better 
off using manual timeouts or use some sort of ajax manager.


  For my setup I used a combination of both, in which I set a timer with a 
certain value for connection timeout, and clear that timer when I actually 
receive data. The timer calls an anonymous function which aborts the ajax 
request (and in my case, calls the request again). This works fine for me.


  Regards,
  -- 
  Martijn.

[jQuery] Re: How to get the number of the selected element?

2009-04-08 Thread Mauricio (Maujor) Samy Silva



I got 10 links on a site, all with the class collapsible.


jQuery:
$(document).ready(function(){
$('.collapsible').click(function() {
var indexLink = $('.collapsible').index(this);
var nClicked = indexLink + 1;
alert(nClicked);
});
});
HTML
a href=# class=collapsible1/a
a href=# class=collapsible2/a
a href=# class=collapsible3/a
...
Maurício 



[jQuery] Re: Delay for $get.Script() callback function

2009-04-08 Thread Mauricio (Maujor) Samy Silva


Thanks Ken
Now I get it!
Maurício

-Mensagem Original- 
De: ken jqu...@kenman.net

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: quarta-feira, 8 de abril de 2009 18:10
Assunto: [jQuery] Re: Delay for $get.Script() callback function



Might be a little late, but... you failed to include the full
description for $.getScript(), or it has changed since you posted this
question. The full description is as follows:




[jQuery] Re: first child

2009-04-07 Thread Mauricio (Maujor) Samy Silva




var $el = xx.is('h2'); //if it indeed matches a h2, returns true?


var el = $('#continer *:first').is('h2');
alert(el); // returns true if first child is H2, false otherwise.

Maurício 



[jQuery] Re: jQuery within Javascript?

2009-04-07 Thread Mauricio (Maujor) Samy Silva


Is there a missed closing braket and a double quotes after bgChangerAnchor?


 $(*[id^='bgChangerAnchor').click(function () {




[jQuery] Re: Combining Selectors

2009-04-05 Thread Mauricio (Maujor) Samy Silva



De: Nic Hubbard nnhubb...@gmail.com

I am confused why the following is returning undefined:

alert($(this +  input[type='submit']).attr('id'));


Try the following:
Get rid of the blank space  before input.
from: ...  input[type='submit'] ...
to: ... input[type='submit'] ...
Regards,
Maurício 



[jQuery] Re: Excluding some children in a selector

2009-04-02 Thread Mauricio (Maujor) Samy Silva



$(#world tr).click(function() {
  // do stuffs
});

Is there a way to prevent the above event from triggering when the
hello button is clicked?


$(#world tr).click(function() {
   $('input[name=hello]').attr('disabled', 'disabled');
// do stuffs
});

$('input[name=hello]').removeAttr('disabled');

Maurício 



[jQuery] Re: Select Last li

2009-04-02 Thread Mauricio (Maujor) Samy Silva



I want to get the last a in the _sub_ list. Here is what I've tried
with no success. Ideas?

$('.list li li:last a').addClass('last-li');
$('.list li ul li:last a').addClass('last-li');
$('.list li:has(ul) li:last a').addClass('last-li');

-

$('.list ul li:last-child a');

Maurício 



[jQuery] Re: DOM manipulation

2009-04-01 Thread Mauricio (Maujor) Samy Silva




   $('.wrapper').height = '1000px';
and that will not work, because we don't have $('.wrapper') in working
what should I do, to accomplish the desirable result?


$('.wrapper').css('height', '1000px');

Maurício 



[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread Mauricio (Maujor) Samy Silva



Is there any major problems you're aware of with this kind of dom
pollution that have a negative impact on ease or performance?


My thoughts:

Firstly: Validate!
But I think that negative impact on whatever isn't the point.
Suppose:
Option 1 - font size=7bHeading level 1/font/b
Option 2 - h1Heading level 1/h1
What option should we use?

So, the point goes beyond validation: It's a semantic issue too.

Specs says: http://www.w3.org/TR/REC-html40/struct/links.html#adef-rel
rel attribute: This attribute describes the relationship from the current 
document to the anchor specified by the href attribute


and says more: http://www.w3.org/TR/REC-html40/index/attributes.html

rel attribute is allowed for A and LINK elements only
---

div class=event-phase rel=1/div
div class=event-phase rel=2/div
div class=event-phase rel=3/div



Instead of



div id=event-phase-1/div
div id=event-phase-2/div
div id=event-phase-3/div


I think that 2nd approach is better not only because  validades but it is a 
easy way to target each element using a counter in the loop.

Something like:

$('.event-phase-' + i)

PS: If you have control over the id name use a shorter one like: evph1, 
evph2 etc...


Regards
Maurício

---




[jQuery] Re: A general Javascript question: duplicate IDs in a document?

2009-03-31 Thread Mauricio (Maujor) Samy Silva




Right, but the problems with that approach is inefficiency. It's more
efficient to grab the entire set of elements via $('.event-phase') and
comparing their rel attribute than it is to throw a loop around $
('.event-phase-' + i);


I think it depends upon the context.
If the loop is needed for achieve the purpouse of the script the approach 
is efficient.





[jQuery] Re: aborting a $.getScript() request

2009-03-26 Thread Mauricio (Maujor) Samy Silva



You're right. A quick look in the bug tracker turns up this ticket:
 http://dev.jquery.com/ticket/1768
Karl Rudd


Tks Karl,
So, there are two questions I made to myself and I am unable to answer:
1-) Does $.getScript()  is a reliable function to use? Is it a useless one?

2-) What does documentation at: 
http://docs.jquery.com/Ajax/jQuery.getScript#urlcallback means when says:
* If you load functions via getScript, make sure to call them after a 
delay.* ?


Any thoughts?
Maurício.



[jQuery] Re: aborting a $.getScript() request

2009-03-26 Thread Mauricio (Maujor) Samy Silva


1-) For remote calls, even script exists,  in case server is down the issue 
arises.

2-) It will be great some advise from a member of jQuery team.

Maurício.
-
De: Karl Rudd karl.r...@gmail.com

Here's my thoughts:

1) It is reliable when dealing with scripts that exist.
2) No idea.

Karl Rudd

.stripped


Tks Karl,
So, there are two questions I made to myself and I am unable to answer:
1-) Does $.getScript() is a reliable function to use? Is it a useless one?

2-) What does documentation at:
http://docs.jquery.com/Ajax/jQuery.getScript#urlcallback means when says:
* If you load functions via getScript, make sure to call them after a
delay.* ?




[jQuery] Re: aborting a $.getScript() request

2009-03-25 Thread Mauricio (Maujor) Samy Silva



However  you could set a flag in the success/callback function. After
the getScript() call you could use a setTimeout to test for that flag
after a certain time. If the flag isn't set then the load didn't work
or took too long.
Karl Rudd


Hi  Karl
Thanks a lot for your advise.

The script is working in Firefox and Opera but fails in IE6/IE7 and Safari 
on Windows.


Test case at: http://jsbin.com/atacu
Edit at: http://jsbin.com/atacu/edit

Any thoughts?

var iconLoading = $('img src=icon.gif /');
var pluginLoaded = $('spanPlugin loaded/span');
var requestScript = function() {
$('#carrega').unbind('click'); // prevent popup the alerbox on 2nd click 
when request fails

$(iconLoading).insertAfter('#carrega');

//  Begins Karl suggestion
var someTime = setTimeout( function() {
 var flagTime = true;
 if(flagTime) {
 $(iconLoading).hide();
 alert(Error message.)
 }
}, 3 )  // Wait 30s for request success
//  End Karl suggestion

$.getScript('http://www.domain.com/scrip.js', function() {
clearTimeout(someTime); // Karl suggestion
$(iconLoading).hide();
$(pluginLoaded).insertAfter('#carrega')
.css({background: '#ffc', padding:'3px 5px'})
.fadeOut(3000);
// do something using the just loaded plugin
});
});
};
 $('#carrega').bind('click', requestScript);
})
--

Thanks
Maurício.




[jQuery] Re: tabs into tabs

2009-03-22 Thread Mauricio (Maujor) Samy Silva


Hi Davi,

It is not allowed to have more than one div#tabs
ID's values must be unique in a document.
Regards,
Maurício



-Mensagem Original- 
De: David omertacod...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: domingo, 22 de março de 2009 09:55
Assunto: [jQuery] tabs into tabs




Hi,

probably a simple question ...

if i put a new set of tabs into existing tabs, the new tabs does not
show all i get are text hyperlinks...

The code i use:

so if yuou go to the config tab it should show the new set of tabs

div id=tabs
  ul
   lia href=#tabs-1Home/a/li
   lia href=#tabs-2Config/a/li
   lia href=#tabs-3other/a/li
   /ul
   div id=tabs-1
   Welkom bla bla bla
   /div
   div id=tabs-2

div id=tabs
   ul
   lia href=#tabs-1config 1/a/li
   lia href=#tabs-2config2/a/li
   lia href=#tabs-3config3/a/li
   /ul
   div id=tabs-1

   /div
   div id=tabs-2

   /div
   div id=tabs-3
   /div
   /div 




[jQuery] getJSON() response into a table

2009-03-21 Thread Mauricio (Maujor) Samy Silva


I'm trying to display data from a json request into a table.
Table heading disapear  when the request finishes and I can't figure out
how to fix it.

Test case is hosted at: http://tinyurl.com/couflx

TIA

Maurício




[jQuery] Re: getJSON() response into a table

2009-03-21 Thread Mauricio (Maujor) Samy Silva
Hi Joseph,
Thanks, but this didn't solve.
Any ideas?

Maurício
  -Mensagem Original- 
  De: Joseph Le Brech 
  Para: jquery-en@googlegroups.com 
  Enviada em: sábado, 21 de março de 2009 13:23
  Assunto: [jQuery] Re: getJSON() response into a table


  $.getJSON(url, function(json){
   
  $(json).each(function(){
 row = $(#table).append(tr);
 $(row).append(td).html(json.cell1.value);
 $(row).append(td).html(json.cell2.value);
  });
   
   
  });
   
   
   
  something like this? 
   
  sorry im just coding this blind from my email account.
   
   Date: Sat, 21 Mar 2009 09:09:35 -0700
   From: css.mau...@gmail.com
   To: jquery-en@googlegroups.com
   Subject: [jQuery] getJSON() response into a table
   
   
   
   I'm trying to display data from a json request into a table.
   Table heading disapear when the request finishes and I can't figure out
   how to fix it.
   
   Test case is hosted at: http://tinyurl.com/couflx
   
   TIA
   
   Maurício
   -- 
   View this message in context: 
http://www.nabble.com/getJSON%28%29-response-into-a-table-tp22637265s27240p22637265.html
   Sent from the jQuery General Discussion mailing list archive at Nabble.com.
   


--
  Share your photos with Windows Live Photos – Free. Try it Now! 

[jQuery] Re: getJSON() response into a table

2009-03-21 Thread Mauricio (Maujor) Samy Silva


[SOLVED]
Maurício

-Mensagem Original- 
De: Maujor css.mau...@gmail.com

Para: jquery-en@googlegroups.com
Enviada em: sábado, 21 de março de 2009 13:09
Assunto: [jQuery] getJSON() response into a table




I'm trying to display data from a json request into a table.
Table heading disapear  when the request finishes and I can't figure out
how to fix it.

Test case is hosted at: http://tinyurl.com/couflx

TIA

Maurício
--
View this message in context: 
http://www.nabble.com/getJSON%28%29-response-into-a-table-tp22637265s27240p22637265.html

Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: getJSON() response into a table

2009-03-21 Thread Mauricio (Maujor) Samy Silva


Hi Josh and all

Many thanks for the useful tips. I appreciate it a lot.

As for Maruicio's question...Looks like you solved it.  The link works 
fine in FF.


Yes! I've solved it with a different aproach. I'll try yours ASAP.
-

3) instead of obj['name'] use obj.name

Done! Tks.
-
As  I get rid of the ('#insert_here').empty(); in order to do my solution 
work

now I need disable the 2nd and next clicks on the show button.

I tried unbind() method in a callback function like so:

$('#go').click(function() {
  // the request code
}, function() {
$('#go').unbind('click');
});

But this didn't works!

Any help will be welcome

Regards

Maurício


-Mensagem Original- 
De: Josh Powell seas...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: sábado, 21 de março de 2009 17:16
Assunto: [jQuery] Re: getJSON() response into a table




$.getJSON(url, function(json){
$(json).each(function(){
row = $(#table).append(tr);
$(row).append(td).html(json.cell1.value);
$(row).append(td).html(json.cell2.value);
});
});

something like this?


This is a very, very, very... very slow way to append

var html = 'tbody'
$(json).each(function(){
 html += 'trtd' + json.cell1.value + '/tdtd' +
json.cell2.value + '/td/tr';
});
html += '/tbody';
$('#table').append(html);

Is about 20 times faster.

You can bump it up another couple of times faster by sticking all of
the strings in an array and using .join before inserting them in the
html, but you lose so much legibility of code that I only do that when
doing thousands of string concatenations on large strings.

As for Maruicio's question...Looks like you solved it.  The link works
fine in FF.

A few other tips about the code:

1) do the .append outside of the loop by using the loop to create one
long string for about 10x speed increase.
2) stick the one long string into one DOM node like a tbody for about
a 6x speed increase.
3) instead of obj['name'] use obj.name  They both work, but the first
makes it look like a hash when you are really using properties of an
object.

Cheers,
Josh Powell 



[jQuery] Re: jquery website broken?

2009-03-18 Thread Mauricio (Maujor) Samy Silva
...if it's only broken for some IE 7 users and not for others.

And I am one of the others users, since the site looks perfectly fine on my 
Brazilian-Portuguese version of IE7.

Maurício
  -Mensagem Original- 
  De: Karl Swedberg 
  Para: jquery-en@googlegroups.com 
  Enviada em: quarta-feira, 18 de março de 2009 18:00
  Assunto: [jQuery] Re: jquery website broken?


  Again, there's not a whole lot we can do if we can't replicate the problem. 
Here is what the page looks like in IE 7 for me:


  http://skitch.com/kswedberg/be1wy/ie-7


  See? Looks perfectly fine. It shouldn't be surprising to see the page so 
badly broken if it's only broken for some IE 7 users and not for others.


  If someone who is seeing the page broken can troubleshoot and recommend 
changes to the CSS, I, or one of the other team members, would be happy to 
apply them.



  Thanks,

  --Karl

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







  On Mar 18, 2009, at 4:30 PM, Rick Faircloth wrote:



Yes, I have to say that's it's been very surprising that the
site would be so badly broken in IE 7 since it was put up.
I figured someone would get around to fixing the css...assuming
that's what the problem is.

The site looks great when it's right, but really bad when it
starts flying apart.  Can't we get some love (or at least affection :o)
for the IE 7 version of the jQuery site?

Rick

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of iain.wa...@googlemail.com
Sent: Wednesday, March 18, 2009 9:11 AM
To: jQuery (English)
Subject: [jQuery] jquery website broken?


Hi,

I really want to start using jquery in some places to replace
mootools, however i find it extremely difficult to persuade clients to
go with jquery when the jquery website at http://docs.jquery.com/Main_Page
is completely broken in IE7. Is there any reason for this?





[jQuery] Re: How do I subtract 64 pixels from the value of a div's height?

2009-03-18 Thread Mauricio (Maujor) Samy Silva


Try:

var contentDivHeight = parseInt($('#contentDiv').css('height'));
var calculatedHeight = contentDivHeight - 64 + px;
alert(contentDivHeight)
alert(calculatedHeight)

-Mensagem Original- 
De: Jeremy Coulson jeremycoul...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: quarta-feira, 18 de março de 2009 13:26
Assunto: [jQuery] How do I subtract 64 pixels from the value of a div's 
height?





Here is my code:

$(document).ready(function () {
var contentDivHeight = $('#contentDiv').css('height');
   // pseudo-code: var calculatedHeight = 
$(#clickMe).click(function(){
$(#leftNavBox-contentPages).animate({height: calculatedHeight},
fast);
});
});

I need the value of calculatedHeight to be 64 pixels less than
contentDiv.  So, if contentDiv is 600px, calculatedHeight needs to be
536px.

Jeremy 




[jQuery] Re: How do I translate this in jQuery?

2009-03-03 Thread Mauricio (Maujor) Samy Silva
It seems that you are trying to insert the content of an existent iframe (name 
= iFrameName) into another empty iframe (id = myiFrame-content). 
Is it? If so, do the following:

  var content = $('iframe[name = iFrameName]').attr('src');
 $('#myiFrame-content').attr('src', content); 

Excuse me if I misunderstood your question.

Maurício

  -Mensagem Original- 
  De: Rick Faircloth 
  Para: jquery-en@googlegroups.com 
  Enviada em: terça-feira, 3 de março de 2009 14:56
  Assunto: [jQuery] How do I translate this in jQuery?


  I've made various attempts at translating this into jQuery without success.

   

  I guess I'm just not sufficient enough in regular JS to make it work.

  It's working, but I'd like it to be written as much as possible in jQuery 
syntax.

   

  Would some please translatethe first three lines of this into jQuery for me?

   

  Thanks,

  Rick

   

  function getContentFromIframe(iFrameName) {

   

 var myIFrame = document.getElementById(iFrameName);

 var content  = myIFrame.contentWindow.document.body(innerHTML);

   

 $('#myiFrame-content').append(content); 

   

   

   

  
--

  My reading of history convinces me that most bad government results from too 
much government.

- Thomas Jefferson


[jQuery] Re: Change CSS depending on page you're on

2009-03-01 Thread Mauricio (Maujor) Samy Silva


How about use the widely ways to achieve this?

1-) Via CSS
Assign an ID to the body element for each page, like:
body id=home, body id=about, body id=contact

and an ID for each menu item like:
div id=menu
ul
li id=ho a href=default.aspxhome/a/li
li id=ab a href=about.aspxabout/a/li
   li id=co a href=contact.aspxcontact/a/li
/ul
/div

And CSS selector for current page is:

body#home li#ho a:link,  body#about li#ab a:link, body#contact li#co a:link 
{

...css rules...
   }

2-) Via PHP,ASP or whatever dinamic language

PHP example (I am not familiar with ASP)

?php
$currentpage = basename($_SERVER['SCRIPT_NAME']);
?

lia href=default.php ?php if ($currentpage == 'default.php') {echo 
'class=current_page';} ?home/a/li
lia href=about.php ?php if ($currentpage == 'about.php') {echo 
'class=current_page';} ?about/a/li
lia href=contact.php ?php if ($currentpage == 'contact.php') {echo 
'class=current_page';} ?contact/a/li


CSS:

a.current_page {
... css rules...
   }

Maurício
-Mensagem Original- 
De: expresso dschin...@gmail.com

Para: jquery-en@googlegroups.com
Enviada em: domingo, 1 de março de 2009 21:53
Assunto: [jQuery] Change CSS depending on page you're on





I'm trying to do something simple but this is my first stab at doing this 
in

JQuery.

div id=menu
ul
li class=current_page_item default.aspx home /li
li about.aspx about /li
li contact.aspx contact /li
/ul
/div

based on the page, change the css.  So like doing a window.location and 
then
parse out the url to the page then check.  If it's the about.aspx I need 
to

change the li item's css.
--
View this message in context: 
http://www.nabble.com/Change-CSS-depending-on-page-you%27re-on-tp22280342s27240p22280342.html
Sent from the jQuery General Discussion mailing list archive at 
Nabble.com.






[jQuery] Re: Form inside Form value

2009-02-27 Thread Mauricio (Maujor) Samy Silva


What are the purpouses of nested forms?
Nested forms aren't allowed in HTML markup.
Maurício

-Mensagem Original- 
De: Gordon grj.mc...@googlemail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: sexta-feira, 27 de fevereiro de 2009 06:34
Assunto: [jQuery] Re: Form inside Form value



You cannot have forms within forms, they violate the rules regarding
how a HTML document should be structured.  Furthermore, the browser
and the server both have no clue how to deal with them.

On Feb 27, 9:18 am, Po01 diogoapa...@gmail.com wrote:

Hi, i have a HTML like that:

form 1
form 2
field
/form 2
/form 1

Supposing the field name is email, how can i get its value using
Javascript/JQuery?
I tried some stuff.. without success..

The form 2 name Im getting as a variable, like:
function values(id)
{
var ID = id;
var Form2 = #form2_ + ID;
...

}

So i need a code that use this Form2 to get the email field value
inside it.
Tried some stuff but dunno how to do that when Form2 is inside Form1.

Thanks. 




[jQuery] Re: :not selector

2009-02-27 Thread Mauricio (Maujor) Samy Silva


Hi Pedro,
It is hard to figure out what you are trying to select without a look on the 
HTML markup.
What does you mean with half of the elements i get with? It depends upon 
the markup!

In nth-child(n)  is n constant or inside a loop?
How about a sample of your markup and information about what are you tryong 
to select?

Maurício

-Mensagem Original- 
De: PedroSeabra pedro.sea...@portugalmail.pt

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: sexta-feira, 27 de fevereiro de 2009 09:10
Assunto: [jQuery] :not selector




when I do this:

$(*:not(.oneClass,(.oneClass :nth-child(n
or
$(*:not(.oneClass,.oneClass :nth-child(n)))

it returns 0 elements, but

$(.oneClass,(.oneClass :nth-child(n)))

returns only about half of the elements i get with

$(*)

am i doing something wrong?

is there any known bug's of the :not selector for this sort of things? 




[jQuery] Re: Multiselect listbox

2009-02-25 Thread Mauricio (Maujor) Samy Silva


Try this:
script type=text/javascript
$(document).ready(function(){
  var ok = '';
  $('button').click(function() {
$('#my_form input[type = checkbox]').each(function() {
if ( $(this).attr('checked') ) {ok = true}
})
ok ? alert('there is at least one checked') : alert('none checked');
});
});
/script
/head
body

form id=my_form action= method=get
input name=whatever_name1 type=checkbox value=a /
input name=whatever_name2 type=checkbox value=b /
/form
button type=buttonChecked?/button

/body
/html

Maurício

-Mensagem Original- 
De: Frederik Ring frederik.r...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: quarta-feira, 25 de fevereiro de 2009 08:27
Assunto: [jQuery] Re: Multiselect listbox



The thing is you will not select a named element by $('.name') but an
element of the class name.

How does your HTML look like?

On Feb 25, 12:14 pm, Bluesapphire michealg...@gmail.com wrote:

Hi!
Thanks for guidance. I have changed JS code as follows. And now it
is totally ignoring the check.

My listbox name is zonelocation[] . I have used name with/without
DOT in JQUERY identifier placeholder. The result is same.

/*/
var zonelocationVal;

jQuery(.'zonelocation[]').each(function(){

if(jQuery('.zonelocation[]').attr('checked') == 'checked'){
zonelocationVal = true;
}
});
/*/

What Iam doing wrong?

Thanks in advance.

On Feb 25, 3:45 pm, Frederik Ring frederik.r...@gmail.com wrote:

 Also remove the else-part of the attribute checking, this way it'll
 only return true if the last element is checked.

 On Feb 25, 11:41 am, Frederik Ring frederik.r...@gmail.com wrote:

  2 things: you are referring to multiple checkboxes, but do that with
  an ID (#zonelocation). That will not work. Use a class instead.

  Second: Depending on the type of your checkboxes and your DOCTYPE you
  might need to change the attr('checked') == 'checked' according to
  your needs. I only used this as a placeholder.

  On Feb 25, 11:26 am, Bluesapphire michealg...@gmail.com wrote:

   Thanks for guidance.

   My JS code is as follows:
   //
   var zonelocationVal;

   jQuery('#zonelocation').each(function(){
   if(jQuery('#zonelocation').attr('checked') == 'checked'){
   zonelocationVal = true;
   }
   else{
   zonelocationVal = false;
   }
   });

   /***/

   Problem is that, if I select atleast one record, even then
   'zonelocationVal' is always false.

   Can you guide me , how to solve this problem.

   Thanks in advance

   On Feb 25, 2:04 pm, Frederik Ring frederik.r...@gmail.com wrote:

You could do sth like:

var ok = false;

$('.elementInListbox').each(function(){
if ($(this).attr('checked') == checked){ok = true);}

});

You will have to set your attributes according to the type of your
elements though.

On Feb 25, 9:55 am, Bluesapphire michealg...@gmail.com wrote:

 Hi!
 How can i check that atleast one option is selected in 
 multiselect

 listbox. How can this be done through JQUERY.

 Thanks in advance- Hide quoted text -

- Show quoted text -- Hide quoted text -

 - Show quoted text -






[jQuery] Re: tbody:first-child thead

2009-02-25 Thread Mauricio (Maujor) Samy Silva
Hi Alex,

1-) Doesn't work because * E F:first-child * pseudo-class selector matches the 
F element that is the first child of the E element ONLY if there isn't another 
element BEFORE the E element within the parent E. See specs at: 
http://www.w3.org/TR/CSS2/selector.html#first-child

 2-) If you have a thead or/and a tbody in your markup, to select the first 
thead use the pseudo-class :eq instead. 

$(#myTable tbody:eq(0) tr).length )

Maurício
  -Mensagem Original- 
  De: Alex Wibowo 
  Para: jquery-en@googlegroups.com 
  Enviada em: quarta-feira, 25 de fevereiro de 2009 08:33
  Assunto: [jQuery] Re: tbody:first-child  thead


  Hi Karl.. thanks for the reply...

  what i actually wanted is to select the first tbody thats why i 
specified tbody:first-child there
  since a table can have multiple tbody... i want to select the first tbody.

  What I didnt understand is about the thead..

  the following works


  table id=myTable
 tbody
  tr
   
  /tr
/tbody
  /table

  $(#myTable  tbody:first-child  tr).length;


  but this doesnt work:



  table id=myTable
 thead
 tr
  ...
 /tr
/thead

 tbody
  tr
   
  /tr
/tbody
  /table

  $(#myTable  tbody:first-child  tr).length;


  I dont know how  thead causes the second code above not to work...





  On Wed, Feb 25, 2009 at 8:11 PM, Karl Rudd karl.r...@gmail.com wrote:


tbody:first-child doesn't select the first child of the tbody it
says select the tbody that is the 'first-child' of it's parent.

So what you are actually wanting to say is:

$(#myTable tbody tr:first-child)

Which is select the tr that is the first child of tbody

http://docs.jquery.com/Selectors/firstChild

Karl Rudd


On Wed, Feb 25, 2009 at 8:08 PM, Alex Wibowo alexwib...@gmail.com wrote:
 sorry i should say
 how does that explain the behaviour when there's no thead (because it
 works when thead doesnt exist)

 On Wed, Feb 25, 2009 at 8:06 PM, Alex Wibowo alexwib...@gmail.com wrote:

 how does that explain the behaviour when there's thead then??


 On Wed, Feb 25, 2009 at 7:47 PM, David Muir davidkm...@gmail.com wrote:

 It's because tbody:first-child is already selecting the tr, so you're
 effectively doing:
 tbody tr tr (where the first tr is the first child of tbody)

 Cheers,
 David


 Alex Wibowo wrote:

 Hi all,

 I have a code that counts the number of rows in a table...

 the table looks like:

 table id=myTable
  thead
   ...
   /thead

   tbody
tr
 
/tr
  /tbody
 /table


 and my jquery looks like:

 $(#myTable  tbody:first-child  tr).length;

 strange enough that always returns 0.
 but if i remove the thead from the table... then it will return the
 correct number of rows..

 or alternatively, i can keep the thead, but use the following instead:

 $(#myTable  tbody  tr).length;

 i.e. without specifying first-child.

 Can anyone explain this behaviour?



 THanks a lot!



 --
 Best regards,


 WiB





 --
 Best regards,


 WiB




 --
 Best regards,


 WiB






  -- 
  Best regards,


  WiB



[jQuery] Re: tbody:first-child thead

2009-02-25 Thread Mauricio (Maujor) Samy Silva
Ops! my faul! sorry.
Previous post errata.

Read: ...BEFORE the F element ...

instead of:  ...BEFORE the E element... 



  -Mensagem Original- 
  De: Mauricio (Maujor) Samy Silva 
  Para: jquery-en@googlegroups.com 
  Enviada em: quarta-feira, 25 de fevereiro de 2009 09:24
  Assunto: Re: [jQuery] Re: tbody:first-child  thead


  Hi Alex,

  1-) Doesn't work because * E F:first-child * pseudo-class selector matches 
the F element that is the first child of the E element ONLY if there isn't 
another element BEFORE the E element within the parent E. See specs at: 
http://www.w3.org/TR/CSS2/selector.html#first-child

   2-) If you have a thead or/and a tbody in your markup, to select the first 
thead use the pseudo-class :eq instead. 

  $(#myTable tbody:eq(0) tr).length )

  Maurício
-Mensagem Original- 
De: Alex Wibowo 
Para: jquery-en@googlegroups.com 
Enviada em: quarta-feira, 25 de fevereiro de 2009 08:33
Assunto: [jQuery] Re: tbody:first-child  thead


Hi Karl.. thanks for the reply...

what i actually wanted is to select the first tbody thats why i 
specified tbody:first-child there
since a table can have multiple tbody... i want to select the first tbody.

What I didnt understand is about the thead..

the following works


table id=myTable
   tbody
tr
 
/tr
  /tbody
/table

$(#myTable  tbody:first-child  tr).length;


but this doesnt work:



table id=myTable
   thead
   tr
...
   /tr
  /thead

   tbody
tr
 
/tr
  /tbody
/table

$(#myTable  tbody:first-child  tr).length;


I dont know how  thead causes the second code above not to work...





On Wed, Feb 25, 2009 at 8:11 PM, Karl Rudd karl.r...@gmail.com wrote:


  tbody:first-child doesn't select the first child of the tbody it
  says select the tbody that is the 'first-child' of it's parent.

  So what you are actually wanting to say is:

  $(#myTable tbody tr:first-child)

  Which is select the tr that is the first child of tbody

  http://docs.jquery.com/Selectors/firstChild

  Karl Rudd


  On Wed, Feb 25, 2009 at 8:08 PM, Alex Wibowo alexwib...@gmail.com wrote:
   sorry i should say
   how does that explain the behaviour when there's no thead (because it
   works when thead doesnt exist)
  
   On Wed, Feb 25, 2009 at 8:06 PM, Alex Wibowo alexwib...@gmail.com 
wrote:
  
   how does that explain the behaviour when there's thead then??
  
  
   On Wed, Feb 25, 2009 at 7:47 PM, David Muir davidkm...@gmail.com 
wrote:
  
   It's because tbody:first-child is already selecting the tr, so you're
   effectively doing:
   tbody tr tr (where the first tr is the first child of tbody)
  
   Cheers,
   David
  
  
   Alex Wibowo wrote:
  
   Hi all,
  
   I have a code that counts the number of rows in a table...
  
   the table looks like:
  
   table id=myTable
thead
 ...
 /thead
  
 tbody
  tr
   
  /tr
/tbody
   /table
  
  
   and my jquery looks like:
  
   $(#myTable  tbody:first-child  tr).length;
  
   strange enough that always returns 0.
   but if i remove the thead from the table... then it will return the
   correct number of rows..
  
   or alternatively, i can keep the thead, but use the following 
instead:
  
   $(#myTable  tbody  tr).length;
  
   i.e. without specifying first-child.
  
   Can anyone explain this behaviour?
  
  
  
   THanks a lot!
  
  
  
   --
   Best regards,
  
  
   WiB
  
  
  
  
  
   --
   Best regards,
  
  
   WiB
  
  
  
  
   --
   Best regards,
  
  
   WiB
  
  




-- 
Best regards,


WiB



[jQuery] Re: tbody:first-child thead

2009-02-25 Thread Mauricio (Maujor) Samy Silva
jQuery uses the power of CSS selectors.

:first-child is an CSS pseudo-class selector and eq() isn't from CSS sintax.

Further reading: 
http://www.456bereastreet.com/archive/200509/css_21_selectors_part_1/

Maurício
  -Mensagem Original- 
  De: Alex Wibowo 
  Para: jquery-en@googlegroups.com 
  Enviada em: quarta-feira, 25 de fevereiro de 2009 09:43
  Assunto: [jQuery] Re: tbody:first-child  thead


  ahhh
  ok ... now i get it. sorry for wasting your time, guys...
  i thought its E F:first-child reads the first child of E of type F... i 
didn't know that it has to explicitly be the first child.

  I didnt even know that this syntax is CSS thing i thought it is jQuery's 
syntax.

  Thanks for pointing out to that website!

  Question   is:first  :eq(n)  also a CSS syntax?


  Thanks again!



  On Wed, Feb 25, 2009 at 11:29 PM, Mauricio (Maujor) Samy Silva 
css.mau...@gmail.com wrote:

Ops! my faul! sorry.
Previous post errata.

Read: ...BEFORE the F element ...

instead of:  ...BEFORE the E element... 



  -Mensagem Original- 
  De: Mauricio (Maujor) Samy Silva 
  Para: jquery-en@googlegroups.com 
  Enviada em: quarta-feira, 25 de fevereiro de 2009 09:24
  Assunto: Re: [jQuery] Re: tbody:first-child  thead


  Hi Alex,

  1-) Doesn't work because * E F:first-child * pseudo-class selector 
matches the F element that is the first child of the E element ONLY if there 
isn't another element BEFORE the E element within the parent E. See specs at: 
http://www.w3.org/TR/CSS2/selector.html#first-child

   2-) If you have a thead or/and a tbody in your markup, to select the 
first thead use the pseudo-class :eq instead. 

  $(#myTable tbody:eq(0) tr).length )

  Maurício
-Mensagem Original- 
De: Alex Wibowo 
Para: jquery-en@googlegroups.com 
Enviada em: quarta-feira, 25 de fevereiro de 2009 08:33
Assunto: [jQuery] Re: tbody:first-child  thead


Hi Karl.. thanks for the reply...

what i actually wanted is to select the first tbody thats why i 
specified tbody:first-child there
since a table can have multiple tbody... i want to select the first 
tbody.

What I didnt understand is about the thead..

the following works


table id=myTable
   tbody
tr
 
/tr
  /tbody
/table

$(#myTable  tbody:first-child  tr).length;


but this doesnt work:



table id=myTable
   thead
   tr
...
   /tr
  /thead

   tbody
tr
 
/tr
  /tbody
/table

$(#myTable  tbody:first-child  tr).length;


I dont know how  thead causes the second code above not to work...





On Wed, Feb 25, 2009 at 8:11 PM, Karl Rudd karl.r...@gmail.com wrote:


  tbody:first-child doesn't select the first child of the tbody it
  says select the tbody that is the 'first-child' of it's parent.

  So what you are actually wanting to say is:

  $(#myTable tbody tr:first-child)

  Which is select the tr that is the first child of tbody

  http://docs.jquery.com/Selectors/firstChild

  Karl Rudd


  On Wed, Feb 25, 2009 at 8:08 PM, Alex Wibowo alexwib...@gmail.com 
wrote:
   sorry i should say
   how does that explain the behaviour when there's no thead 
(because it
   works when thead doesnt exist)
  
   On Wed, Feb 25, 2009 at 8:06 PM, Alex Wibowo alexwib...@gmail.com 
wrote:
  
   how does that explain the behaviour when there's thead then??
  
  
   On Wed, Feb 25, 2009 at 7:47 PM, David Muir davidkm...@gmail.com 
wrote:
  
   It's because tbody:first-child is already selecting the tr, so 
you're
   effectively doing:
   tbody tr tr (where the first tr is the first child of tbody)
  
   Cheers,
   David
  
  
   Alex Wibowo wrote:
  
   Hi all,
  
   I have a code that counts the number of rows in a table...
  
   the table looks like:
  
   table id=myTable
thead
 ...
 /thead
  
 tbody
  tr
   
  /tr
/tbody
   /table
  
  
   and my jquery looks like:
  
   $(#myTable  tbody:first-child  tr).length;
  
   strange enough that always returns 0.
   but if i remove the thead from the table... then it will return 
the
   correct number of rows..
  
   or alternatively, i can keep the thead, but use

[jQuery] Re: Issue with addClass and removeClass

2009-02-25 Thread Mauricio (Maujor) Samy Silva


You must re-bind the click event to the classes every time you change it.
Use the newest live () method added in 1.3 version of jQuery library [1].

$(document).ready(function() {
$('.large').live(click, function(){
...

and

$(document).ready(function() {
$('.small').live(click, function(){
..

[1] http://docs.jquery.com/Events/live

Maurício

-Mensagem Original- 
De: Larry malariasta...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: quarta-feira, 25 de fevereiro de 2009 12:53
Assunto: [jQuery] Issue with addClass and removeClass




Below is my complete page. I have two divs, one with class 'large' and
one with class 'small'. When you click on the div with the 'small'
class, I want to change it to 'large' and vice versa. The classes seem
to change as I alert() the small or large class values and they seem
correct BUT the div seems to stay bound to the original click function
even though the div should/does not have the small class anymore,
the .small.clcik event is getting called. Any help would be
appreciated. I am sure I am missign something real easy!?

 Thank you, Larry


html
head
style type=text/css
.large { font-size:36px; }
.small { font-size:16px; }
/style

titlejQuery Class Add/Remove Test/title

script type=text/javascript src=jquery-1.3.2.js/script

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

$('.large').click(function(){
alert(.large.click());

alert(large (should be true) =  + $(this).hasClass(large));
alert(small (should be false) =  + $(this).hasClass(small));

$(this).removeClass(large);
$(this).addClass(small);

$(this).html(I am now small - click to make large);

return false;
});

$('.small').click(function(){
alert(.small.click());

alert(large (should be false) =  + $(this).hasClass(large));
alert(small (should be true) =  + $(this).hasClass(small));

$(this).removeClass(small);
$(this).addClass(large);

$(this).html(I am now large - click to make small);
return false;
});
});
/script
/head

body
div id=div1 class=largeI am large - click to make small/div
div id=div2 class=smallI am small - click to make large/div
/body
/html 




[jQuery] Re: ~ selector is not selecting siblings

2009-02-25 Thread Mauricio (Maujor) Samy Silva


Hi RadicalBender,

How about use the $('tr td:empty') selector to target the empties rows?

Not solve?
So,
need some more information to try figure out a solution.
Are there tbody, tfoot and thead in your table?
Where is located the  tr#NoSongs?
Would you please show a simplified sample of the table markup?

Maurício


-Mensagem Original- 
De: RadicalBender radicalben...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: quarta-feira, 25 de fevereiro de 2009 16:28
Assunto: [jQuery] ~ selector is not selecting siblings




I have a table that has a list of songs - one for each row. I also
have a select menu that populates the song table data from an AJAX
query based on what was selected.

The first row of the table is a row (#NoSongs) that just says No
songs were found. in case no records were returned. And I just hide
and show that depending on the results.

Whenever the select menu is changed, it calls a function where the
logic is like this:

function ChangeSongs() {

$(#NoSongs ~ tr).fadeOut('slow',function() {
$(#NoSongs ~ tr).remove();
});

// AJAX Query and a bunch of logic to create new table rows --
Everything here on works fine.

}

The problem is that $(#NoSongs ~ tr) isn't finding any of its
siblings. So, it just keeps adding new rows without deleting the old
ones.  And $(#NoSongs ~ tr).size() returns 0 for some reason.

I could try .siblings() but I only want the rows after #NoSongs
(there's a table header row as well) and .siblings() returns all
siblings forward and backward.

I'm stumped. It should work even if #NoSongs is hidden from view,
right? I'm really not comprehending why this isn't working.

Any help would be appreciated. Sorry I can't show the actual code or
site. 




[jQuery] Re: How to color a selected option in a select that will work on FF.

2009-02-22 Thread Mauricio (Maujor) Samy Silva


background-color CSS property is well supported by IE and FF (Chrome not 
tested)

So, double check your HTMl and CSS sintax.

Here an example working:

CSS:
#a { background-color:#A0; }

HTML
form
Select your favorite fruit:
select id=fruits
 optionApple/option
 option id=aOrange/option
 optionPineapple/option
 option style=background-color:#f00;Banana/option
/select
/form

Maurício
---

Hi,
I've added: style=background-color:#A0;
to one of the options in a select it works well on IE but not on FF
and Chrome.
Any Ideas? 




[jQuery] Re: using :has with selector

2009-02-10 Thread Mauricio (Maujor) Samy Silva



TD is a TR children so use the CSS descendant selector tr td.

$(#tableid tbody tr td.someclass:contains('mytext'))).dosomething();

PS: mytext is a string and should be quoted.

Maurício


-Mensagem Original- 
De: SteelRing steelr...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: terça-feira, 10 de fevereiro de 2009 19:57
Assunto: [jQuery] using :has with selector




Anyone can think of a reason why this shouldn't work? I'm trying to
select the Row (tr) where the cell of td with class someclass
contains mytext. Since I want to work on the row (tr) itself, I need
to use :has because I don't need to select the td itself. Am I wrong
or am I wrong?

$(#tableid tbody tr:has(td.someclass:contains(mytext))).dosomething
(); 




[jQuery] Re: Using selectors successfully...?

2009-02-07 Thread Mauricio (Maujor) Samy Silva


There is nothing wrong with your jQuery code.
Double check the link to jQuery library and the HTML markup.

Try this example tested here:

style type=text/css media=all
.midget {background:red}
/style

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


script type=text/javascript
$(document).ready(function(){
$(.testclass).each(function(){
$(this).addClass(midget);
});
});
/script
...
body
p class=testclassSome text/p
b class=testclassSome bold text/b
...



-Mensagem Original- 
De: gberz3 gbe...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: domingo, 8 de fevereiro de 2009 01:07
Assunto: [jQuery] Using selectors successfully...?




Will someone please explain to me why the following code fails to
execute?  I have a simple test page set up and jquery doesn't seem
happy with what I'm trying to do.  I get no errors, and when I log to
console in firebug it shows that it is indeed finding my two objects,
however it won't actually perform 'addClass':


$(document).ready(function() {

$(.testclass).each(function(){
$(this).addClass(midget);
});
});




At first I just figured it was because I wasn't doing an each, but
then after trying each and having it still fail, I was back to square
one.  Also, is it not possible to select based on tags (e.g.
'div.divclass')?

Any help would be much appreciated.


Best! 




[jQuery] Re: $.browser and jQuery 1.3

2009-02-05 Thread Mauricio (Maujor) Samy Silva


Liam,
Quoting the documentation:
It's important to note that jQuery.browser is still in jQuery - and will be 
for the foreseeable future (too many plugins and pieces of code depend on 
it).
Read the full section at: 
http://docs.jquery.com/Release:jQuery_1.3#No_More_Browser_Sniffing


Maurício

-Mensagem Original- 
De: Liam Potter radioactiv...@gmail.com

Para: jquery-en@googlegroups.com
Enviada em: quinta-feira, 5 de fevereiro de 2009 07:23
Assunto: [jQuery] $.browser and jQuery 1.3




Why is this deprecated in 1.3?
I use a script using this, to add the browser name and version to the body 
tag so I can apply css to those browsers without hacks.
Is there another way of doing this now, as I can't figure out how I would 
do this with $.support.


- Liam






[jQuery] Re: dynamically building the for attribute

2009-02-05 Thread Mauricio (Maujor) Samy Silva


$('#my-form label').each(function() {
  var checkboxId = $(this).prev(':checkbox').attr('id')
  $(this).attr('for', checkboxId)


Maurício

-Mensagem Original- 
De: paulinstl paulsha...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: quinta-feira, 5 de fevereiro de 2009 12:25
Assunto: [jQuery] dynamically building the for attribute




I have a series of labels and checkboxes.

The checkboxes' IDs are generated on the fly, so I have no way of
knowing the id at the server (without a lot of heavy lifting).

I'd like to do this in jquery...

here's what I have so far

HTML
input id=Checkbox1 type=checkbox value=x /labelsomething/
labelbr /
input id=Checkbox2 type=checkbox value=x /labelsomething/
labelbr /
input id=Checkbox3 type=checkbox value=x /labelsomething/
labelbr /
input id=Checkbox4 type=checkbox value=x /labelsomething/
labelbr /

jquery

$(label).attr(for, $
(this).somethingToGoHereToSetTheIdOfThePrevElement.text
()  );

I'm missing the way to traverse this 




[jQuery] Re: dynamically building the for attribute

2009-02-05 Thread Mauricio (Maujor) Samy Silva


Hi Paul,

$(':checkbox') matches all inputs elements whose type is checkbox.
Inputs are implied in this selector, so you don't need modify it. :)

Maurício

-Mensagem Original- 
De: paulinstl paulsha...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: quinta-feira, 5 de fevereiro de 2009 14:28
Assunto: [jQuery] Re: dynamically building the for attribute



Mauricio,

This was exactly what I needed... I modified it a bit (:checkbox to
input:checkbox) and closed out the function.

$('#searchresults  div  label').each(function() { var checkboxId = $
(this).prev('input:checkbox').attr('id'); $(this).attr('for',
checkboxId) });


On Feb 5, 8:52 am, Mauricio \(Maujor\) Samy Silva
css.mau...@gmail.com wrote:

$('#my-form label').each(function() {
var checkboxId = $(this).prev(':checkbox').attr('id')
$(this).attr('for', checkboxId)

Maurício

-Mensagem Original-
De: paulinstl paulsha...@gmail.com
Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: quinta-feira, 5 de fevereiro de 2009 12:25
Assunto: [jQuery] dynamically building the for attribute





 I have a series of labels and checkboxes.

 The checkboxes' IDs are generated on the fly, so I have no way of
 knowing the id at the server (without a lot of heavy lifting).

 I'd like to do this in jquery...

 here's what I have so far

 HTML
 input id=Checkbox1 type=checkbox value=x /labelsomething/
 labelbr /
 input id=Checkbox2 type=checkbox value=x /labelsomething/
 labelbr /
 input id=Checkbox3 type=checkbox value=x /labelsomething/
 labelbr /
 input id=Checkbox4 type=checkbox value=x /labelsomething/
 labelbr /

 jquery

 $(label).attr(for, $
 (this).somethingToGoHereToSetTheIdOfThePrevElement.text
 () );

 I'm missing the way to traverse this- Hide quoted text -

- Show quoted text - 




[jQuery] Re: Select element based on a value of its child element

2009-02-04 Thread Mauricio (Maujor) Samy Silva


$('div:has(input[value=2])')

Maurício

-Mensagem Original- 
De: Adrian Lynch adely...@googlemail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: quarta-feira, 4 de fevereiro de 2009 09:22
Assunto: [jQuery] Select element based on a value of its child element




Hello all. I have the following...

div
input type=text value=1 /
/div
div
input type=text value=2 /
/div
div
input type=text value=3 /
/div

... and I want to select the second div because its child input has a
value of 2.

I know I could select the input then come back to the div with parents
(div). Just wondering if there's a way to do it in the selector
string.

More out of curiosity than need ;)

Thanks.

Adrian 




[jQuery] Re: how to get action attribute from form

2009-02-03 Thread Mauricio (Maujor) Samy Silva


Both ways works fine!

Please:
1- check the link to jquery library in the document ,
2- don't forget to wrapper the script within ready() method,
3- double check the script and markup sintax.

Maurício

-Mensagem Original- 
De: bob xoxeo...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: terça-feira, 3 de fevereiro de 2009 19:53
Assunto: [jQuery] how to get action attribute from form




Hi,

How do I get action attribute from the following form if I know id and
name values.


form name=myForm id=myForm method=post action=register.php
onsubmit=return false;

I tried those and it did not work:

$(form[name=myForm]).attr('action');
$(#myForm).attr('action'); 




[jQuery] Re: How do I get the index of the currently clicked textbox?

2009-02-02 Thread Mauricio (Maujor) Samy Silva


Try:

$('input[type=text]').each(function(i) {
 $(this).click(function() {
  alert(i);
 });
});

Maurício

-Mensagem Original- 
De: bittermonkey brakes...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: segunda-feira, 2 de fevereiro de 2009 17:47
Assunto: [jQuery] How do I get the index of the currently clicked textbox?




Hi,

How do I get the index of the currently clicked textbox?  I have 5
textboxes in a form, all of which I am binding a click event.  Here is
the code:

   $(#associate-form input[type=text]).bind(click, function()
{
   alert(this);  //what is its index position from the 5
other textboxes?
   });

Thanks in advance. 




[jQuery] Re: How do I get the index of the currently clicked textbox?

2009-02-02 Thread Mauricio (Maujor) Samy Silva


Hi Bittermonkey,
There is a great explanation with examples on jQuery documentation.
Please have a look at:
http://docs.jquery.com/Utilities/jQuery.each#objectcallback

Good luck
Maurício

-Mensagem Original- 
De: bittermonkey brakes...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: segunda-feira, 2 de fevereiro de 2009 19:05
Assunto: [jQuery] Re: How do I get the index of the currently clicked 
textbox?




Stephan, that was a good suggestion but I'm trying to minimize HTML
code because the page I am working on is asp.net.  That's a useful
trick to know.

Mauricio it worked like a charm.  Thank you so much.  If you don't
mind, can you briefly explain why function(i) seems to know the
element's index?

On Feb 2, 3:08 pm, Mauricio \(Maujor\) Samy Silva
css.mau...@gmail.com wrote:

Try:

$('input[type=text]').each(function(i) {
$(this).click(function() {
alert(i);
});
});

Maurício

-Mensagem Original-
De: bittermonkey brakes...@gmail.com
Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: segunda-feira, 2 de fevereiro de 2009 17:47
Assunto: [jQuery] How do I get the index of the currently clicked textbox?



 Hi,

 How do I get the index of the currently clicked textbox? I have 5
 textboxes in a form, all of which I am binding a click event. Here is
 the code:

 $(#associate-form input[type=text]).bind(click, function()
 {
 alert(this); //what is its index position from the 5
 other textboxes?
 });

 Thanks in advance. 




[jQuery] Re: DOM manipoulation after ajax load

2009-02-02 Thread Mauricio (Maujor) Samy Silva


Hi HK
It doesn't works because elements loaded via AJAX isn't available when the 
page is just loaded.
Before version 1.3.1 to bind events to elements loaded via AJAX you must use 
the LIVEQUERY plugin.
Version (1.3) 1.3.1 added the live() and die() methods that should solve 
your problem.


Have a look at: http://docs.jquery.com/Events/live#typefn

Maurício

-Mensagem Original- 
De: HK hkosm...@gmail.com

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: segunda-feira, 2 de fevereiro de 2009 09:21
Assunto: [jQuery] DOM manipoulation after ajax load




Hello,

I have the following case and I don't know what's happening...

I have a sidebar #menu where in document ready I have:

$('#menu).load('/menu')

#menu is loaded with something like:
div id=menu
 div id=level1
various a tags
 /div

 div id=level2
   various a tags
 /div

 div id=level3
 various a tags
 /div

/div

Now I want to assign to each of the a tags some click functions. I
do :

$(document).ready(function() {
  $('#menu).load('/menu');
  $('#level1 a').each(function(){$(this).click(function(){alert
'test'})})
})

But this doesn't work. Can jquery access elements it has loaded with
load ajax function?

thanks 




[jQuery] Re: Triggering a link with no click event

2009-01-31 Thread Mauricio (Maujor) Samy Silva


Try:
function linkClick() {
 var target = $('body').find('#test').attr('href');
 window.location = target;
}

Maurício

-Mensagem Original- 
De: Andy789 e...@abcstudio.com.au

Para: jQuery (English) jquery-en@googlegroups.com
Enviada em: sábado, 31 de janeiro de 2009 05:15
Assunto: [jQuery] Triggering a link with no click event




HI All,

It could be a silly question, but I cannot find a simple answer...

I need to trigger a link with href via an external function, i.e.

div onclick=linkClick()Emulating click/div
a id=test href=flash/pdfs/test.html my link/a

function linkClick(){
$(#test).click();

}

It does not work and returns nothing. I understanbd that it is because
the a#test does not have the actual onclick event. So, how can I
emulate click on a#test?

Note, that I cannot modify the a link element or add onclick events. 




  1   2   >