[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery

2009-04-14 Thread Lwangaman

Ok latest version I've included the possibility of adding a background
color:
http://jsbin.com/icena/edit

The background color is specified as a second parameter in the
function:
$('table').dragCheck('td:not(.nono) :checkbox', 'pink')

To clear the dragCheck:
$('table').dragCheck('clear')

On 13 Apr, 23:29, jscripter pc88m...@gmail.com wrote:
 Here's what I'm shooting for:

 http://jsbin.com/izoce/edit

 It's basically the same code as found on cross-browser.com, but I've
 added the cell highlighting.

 Works under Firefox, Opera and Chrome. It should also work under IE,
 but it doesn't seem to work when on the jsbin.com site. However, if
 you just download it and run it from a local file it should work for
 you.

 The text selection bug is basically fixed. It is still possible to
 select text if the mousedown event occurs in the right place between
 cells. I don't think text selection is possible if the border width is
 set to 0 (but then you also don't get a border.)

 On Apr 13, 2:30 pm, Lwangaman donjohn.f...@gmail.com wrote:

  I think I've done it.

 http://jsbin.com/adixe/edit

  I have also left out the mouseleave event, and applied the mouseup to
  the whole document instead of to the table, that way even if I leave
  the table but still have the mouse button down, I don't lose the value
  in the variable. Only if I let go of the mouse button (on or off the
  table) do I reset the variable.

  @Ricardo and @jscripter: does this work good?

  On 13 Apr, 14:41, Lwangaman donjohn.f...@gmail.com wrote:

   I tried working on it again and made a little progress... Now I got
   parent and child selected correctly, but I don't have mouseover
   working for some reason...

  http://jsbin.com/avigi/edit

   On 13 Apr, 02:43, Lwangaman donjohn.f...@gmail.com wrote:

One more detail: mouseout should not take effect until mouseup.
In fact, right now, if I click and begin to drag, then still holding
the mouse button I leave the area, and still holding it come back over
the cells, they no longer get checked / unchecked because mouseout has
already kicked in. Instead it shouldn't kick in until I actually let
go of the mouse button, and I could let go of it anywhere on the page
I suppose, so I guess mouseup would have to be applied to the whole
document.

On 13 Apr, 02:33, Lwangaman donjohn.f...@gmail.com wrote:

 I tried something along those lines...

http://jsbin.com/ehedu/edit

 But I just don't have the hang of using this correctly and knowing
 when to refer to dom elements as dom elements or as jquery objects...

 The idea is to tie all events to the container of the checkboxes (i.e.
 table cells), and not to the external container (table or ul list or
 whatever), and yet be able to read and write the value of the
 checkboxes...

 On 13 Apr, 01:13, Lwangaman donjohn.f...@gmail.com wrote:

  Taking up jscripter's suggestion, I just noticed myself that 
  applying
  the mousedown and mouseover to the whole table keeps you from being
  able to click on any links that may be contained in the table. For
  example my table has links in the header cells that when clicked
  reorder the table according to that column. Now I can no longer 
  click
  them...
  And, as jscripter says, in the X-Library the mousedown and mouseover
  was applied to the cells containing the checkboxes and not to the
  checkboxes themselves, so that it was enough to click on the cells
  surrounding the checkboxes in order to get them checked / unchecked.

  Ricardo do you think you could manage something like that? (I'm only
  an apprentice and I don't have your expertice!)

  On 12 Apr, 22:31, jscripter pc88m...@gmail.com wrote:

   Hey - this is great work - I just happened to be looking for this
   functionality.

   How would you apply what you have done here to re-writing the 
   original
   X-library code that uses TDs for the checkbox label?

   Thanks!

   On Apr 12, 2:04 pm, Ricardo ricardob...@gmail.com wrote:

Sure! I have a few other plugins I also want to upload, I'll do 
that.

I took the time to rewrite it more carefully. No more binding/
unbinding, a single var, all namespaced and bugs ironed out (if 
you
put the cursor away while holding the button, the mouseover 
would
remain active even after mouseup).

The advantage of namespacing is you can easily remove all event
handlers. I included that in the plugin, in the example you can 
use $
('ul').dragCheck(false) to disable it completely.

   http://jsbin.com/amoxi/edit

cheers,
- ricardo

On Apr 12, 9:48 am, Lwangaman donjohn.f...@gmail.com wrote:

 @Ricardo
 Do you think it could be useful to add this to the jquery 
 plugins at
 plugins.jquery.com? I'd say it 

[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery

2009-04-14 Thread Lwangaman

Latest: http://jsbin.com/isuga/edit
Simplified the code for the highlighting process and corrected the
case-possibility that first parameter is left empty (in that case, all
child checkboxes are involved).

Empty parameter usage:
$('table').dragCheck()
for no parameters;
$('table').dragCheck('', 'pink')
for empty first parameter.
Second parameter can be left out completely.

On 14 Apr, 09:45, Lwangaman donjohn.f...@gmail.com wrote:
 Ok latest version I've included the possibility of adding a background
 color:http://jsbin.com/icena/edit

 The background color is specified as a second parameter in the
 function:
 $('table').dragCheck('td:not(.nono) :checkbox', 'pink')

 To clear the dragCheck:
 $('table').dragCheck('clear')

 On 13 Apr, 23:29, jscripter pc88m...@gmail.com wrote:

  Here's what I'm shooting for:

 http://jsbin.com/izoce/edit

  It's basically the same code as found on cross-browser.com, but I've
  added the cell highlighting.

  Works under Firefox, Opera and Chrome. It should also work under IE,
  but it doesn't seem to work when on the jsbin.com site. However, if
  you just download it and run it from a local file it should work for
  you.

  The text selection bug is basically fixed. It is still possible to
  select text if the mousedown event occurs in the right place between
  cells. I don't think text selection is possible if the border width is
  set to 0 (but then you also don't get a border.)

  On Apr 13, 2:30 pm, Lwangaman donjohn.f...@gmail.com wrote:

   I think I've done it.

  http://jsbin.com/adixe/edit

   I have also left out the mouseleave event, and applied the mouseup to
   the whole document instead of to the table, that way even if I leave
   the table but still have the mouse button down, I don't lose the value
   in the variable. Only if I let go of the mouse button (on or off the
   table) do I reset the variable.

   @Ricardo and @jscripter: does this work good?

   On 13 Apr, 14:41, Lwangaman donjohn.f...@gmail.com wrote:

I tried working on it again and made a little progress... Now I got
parent and child selected correctly, but I don't have mouseover
working for some reason...

   http://jsbin.com/avigi/edit

On 13 Apr, 02:43, Lwangaman donjohn.f...@gmail.com wrote:

 One more detail: mouseout should not take effect until mouseup.
 In fact, right now, if I click and begin to drag, then still holding
 the mouse button I leave the area, and still holding it come back over
 the cells, they no longer get checked / unchecked because mouseout has
 already kicked in. Instead it shouldn't kick in until I actually let
 go of the mouse button, and I could let go of it anywhere on the page
 I suppose, so I guess mouseup would have to be applied to the whole
 document.

 On 13 Apr, 02:33, Lwangaman donjohn.f...@gmail.com wrote:

  I tried something along those lines...

 http://jsbin.com/ehedu/edit

  But I just don't have the hang of using this correctly and knowing
  when to refer to dom elements as dom elements or as jquery 
  objects...

  The idea is to tie all events to the container of the checkboxes 
  (i.e.
  table cells), and not to the external container (table or ul list or
  whatever), and yet be able to read and write the value of the
  checkboxes...

  On 13 Apr, 01:13, Lwangaman donjohn.f...@gmail.com wrote:

   Taking up jscripter's suggestion, I just noticed myself that 
   applying
   the mousedown and mouseover to the whole table keeps you from 
   being
   able to click on any links that may be contained in the table. For
   example my table has links in the header cells that when clicked
   reorder the table according to that column. Now I can no longer 
   click
   them...
   And, as jscripter says, in the X-Library the mousedown and 
   mouseover
   was applied to the cells containing the checkboxes and not to the
   checkboxes themselves, so that it was enough to click on the cells
   surrounding the checkboxes in order to get them checked / 
   unchecked.

   Ricardo do you think you could manage something like that? (I'm 
   only
   an apprentice and I don't have your expertice!)

   On 12 Apr, 22:31, jscripter pc88m...@gmail.com wrote:

Hey - this is great work - I just happened to be looking for 
this
functionality.

How would you apply what you have done here to re-writing the 
original
X-library code that uses TDs for the checkbox label?

Thanks!

On Apr 12, 2:04 pm, Ricardo ricardob...@gmail.com wrote:

 Sure! I have a few other plugins I also want to upload, I'll 
 do that.

 I took the time to rewrite it more carefully. No more binding/
 unbinding, a single var, all namespaced and bugs ironed out 
 (if you
 put the cursor away while holding the button, the 

[jQuery] Re: preloading a div

2009-04-14 Thread Liam Potter


a callback function is something that runs after an action has been 
completed. This is what you need for what you are trying to achieve, I'm 
also going to chain the actions.


$(#div).fadeOut(500, function() {
$(#div).load(url).fadeIn();
});


The 500 is the time in miliseconds it takes to fadeOut, 500 is half a 
second.



Sasser wrote:

hi

i'm new to jquery and got a problem concerning the preloading of
content.
before changing the content dynamically i want to fade it out. so i
tried this:

$(#div).fadeOut();
$(#div).load(url);
$(#div).fadeIn();

this works quite good. there is just the problem that the content
fades in immediately after fading out - there is no time for the
loading of content.

a guy in the irc-channel told me to use a callback function... but i
do not really understand :(

can anyone help me?
thanks!
  


[jQuery] how to create multiple draggable div's with dynamic content

2009-04-14 Thread hybris77

hi, I'm trying to acchieve something for a few days now and I need som
guidence

I need to be able to open a draggabel div, that's no worry using the
jQuery UI plugin

what im not getting my head around is how to create multiple instances
of this window
with dynamic content but with a templade html structure that is filled
with data
from a database

i've tried to use clone() to have the template saved and hidden on
the page but
when using this everything fails to work at all

did anyone acchieve this?

I may be a little fuzzy about what my problem is, there's too much
code to be
posted here, what I need is a little support in my undertaking

/pär


[jQuery] Re: Final Four: Grabbing Keys, Styling Columns, Pop Up Forms, Edit Select Lists?

2009-04-14 Thread Tony

Hello,

#1)
colModel : [
{ name:ID, hidden:true, editable:true, editrules:{edithidden:true},
editoptions:{readonly:true} },
..
]
Look into the docs for more details.

#2) In wich browser is this?

#3) Currently not possible. It is hardcoded in the source. Will try to
put this in the css
in order to be customisable.

#4) Could youi plese the grid configuration and piece of data that is
populated
in the grid.

Regards
Tony

On Apr 14, 2:01 am, briandus bri...@virtual-essentials.com wrote:
 Hi there -  I am using jqGrid with ASP.NET and while it has really
 taken me quite some time to get this integration playing nicely, now
 that I've finally got things moving, I am so pleased. But, I have four
 things that I am still having some trouble with...

 #1)
 I have a table with some hidden fields...the key field is hidden and
 named (ID). In order to get the field to send along with the rest of
 the edit parameters, I had to show the field, but then it shows up as
 editable on the form. When I set 'editable' to false, it no longer
 exists on the field. More importantly, however, is that there is a
 lower case id being sent along with the oper parameter. The id
 field being passed is the row id in the table, not the key field. How
 can I grab and pass the key field?

 #2)
 Since I have enabled editing, everytime I refresh my page, the Add
 record Dialog Box always displays. How can I turn this off?

 #3)
 How can I style the checkbox column as well as the column with the
 Plus sign icon indicating a sub grid? Both of these columns are much
 wider than they need to be.

 #4)
 When I edit a record, the select lists are dynamically populated with
 the correct values as per the colModel, but they are not the existing
 values on the record. For example, if I am editing a record with a
 field value of ON, the edit form shows a select list with OFF and
 ON, but the selected value is OFF...rather than the value already
 exisitng on the record. How can I correct this?

 thanks so much for such a uber wonderful plug in!! :-)


[jQuery] Re: Getting index of clicked table cell

2009-04-14 Thread Thomas

Wow, you had me stumped for a couple of minutes there. :)

I think the .index() method doesn't do what you want it to do.

As I understand it, you use that method on a selection of elements,
pass it an element, and it will search for the element in that
selection.


So if you did

alert($('td', this).index(e.target));

it should return the index you're looking for.



On Apr 13, 8:16 pm, MorningZ morni...@gmail.com wrote:
 For the life of me i cannot figure out why this gives me -1 (not
 found)

 $(#Table1 tr.SUM).click(function(e) {
       alert($(this).index(e.target));

 });

 With this being the row, and e.target being the cell, shouldn't
 that work?


[jQuery] Re: Getting index of clicked table cell

2009-04-14 Thread Tony

Hello,
IMHO this can be:
$(#Table1 tr.SUM).click(function(e) {
  alert(this.rowIndex);
});

Regards
Tony

On Apr 14, 1:46 pm, Thomas thpick...@googlemail.com wrote:
 Wow, you had me stumped for a couple of minutes there. :)

 I think the .index() method doesn't do what you want it to do.

 As I understand it, you use that method on a selection of elements,
 pass it an element, and it will search for the element in that
 selection.

 So if you did

 alert($('td', this).index(e.target));

 it should return the index you're looking for.

 On Apr 13, 8:16 pm, MorningZ morni...@gmail.com wrote:

  For the life of me i cannot figure out why this gives me -1 (not
  found)

  $(#Table1 tr.SUM).click(function(e) {
        alert($(this).index(e.target));

  });

  With this being the row, and e.target being the cell, shouldn't
  that work?


[jQuery] Re: Getting index of clicked table cell

2009-04-14 Thread Tony

Upps, sorry
mixed some code.
$(#Table1 tr.SUM).click(function(e) {
 var td = e.target || e.srcElement
  alert(td.cellIndex);

});


On Apr 14, 2:11 pm, Tony t...@trirand.com wrote:
 Hello,
 IMHO this can be:
 $(#Table1 tr.SUM).click(function(e) {
       alert(this.rowIndex);

 });

 Regards
 Tony

 On Apr 14, 1:46 pm, Thomas thpick...@googlemail.com wrote:

  Wow, you had me stumped for a couple of minutes there. :)

  I think the .index() method doesn't do what you want it to do.

  As I understand it, you use that method on a selection of elements,
  pass it an element, and it will search for the element in that
  selection.

  So if you did

  alert($('td', this).index(e.target));

  it should return the index you're looking for.

  On Apr 13, 8:16 pm, MorningZ morni...@gmail.com wrote:

   For the life of me i cannot figure out why this gives me -1 (not
   found)

   $(#Table1 tr.SUM).click(function(e) {
         alert($(this).index(e.target));

   });

   With this being the row, and e.target being the cell, shouldn't
   that work?


[jQuery] Re: Node click behavior

2009-04-14 Thread edik

Well I found the code-piece where the clik-event is beeing added to
the span element inside of the A element of the LI element of the
tree. If commented out only +/- symbols collapse/expand the tree/
subtree.
Anyway it would be nice to have an option where I can enable/disable
this behaviour without changing original code.

in jquery.treeview.js (not packed)

in function applyClasses

comment out this code at the beginning of the function:

this.filter(:has(ul):not(:has(a))).find(span).click(function
(event) {
toggler.apply($(this).next());
}).add( $(a, this) ).hoverClass();




On 9 Apr., 16:05, edik eduard.mar...@googlemail.com wrote:
 I'm too searching for a way to change theclickbehaviour of the nodes
 (without touching the plugin-source), so that ONLY  +/- expands/
 collapses the node and not theclickon the SPAN element inside the LI-
 element.
 Anybody any suggestions?

 Thanks a lot

 On 10 Mrz., 21:04, Ryan grigg...@gmail.com wrote:



  Is there a way to make a node in thetreeviewexpand/collapse ONLY if
  the +/- is clicked but not the folder icon or folder name but still
  make the node selectable?


[jQuery] Superfish

2009-04-14 Thread timka

Your plugin really easy to use, thanks.
But there is no useful option in my case: openOnClick. I want to open
submenu by click event, not hover.
Could you help me?


[jQuery] [autocomplete] charset

2009-04-14 Thread borutt

Hello,

I'm having problem with charset on searching value, that is returned
in param q.
On main page and od page from where script search for data I have
charset placed:

main script:
meta HTTP-EQUIV='Content-Type' Content='text-html;
charset=windows-1250'

search script:
header( Content-Type: text/html; charset=Windows-1250 );

I get some wierd characters when I use unicode characted like š,č,ž.

Thanks


[jQuery] Re: Node click behavior

2009-04-14 Thread edik

Or comment just

 toggler.apply($(this).next());

in the programmcode mentioned in the previous post, to leave the hover
of the A-element untouched



On 14 Apr., 13:54, edik eduard.mar...@googlemail.com wrote:
 Well I found the code-piece where the clik-event is beeing added to
 the span element inside of the A element of the LI element of the
 tree. If commented out only +/- symbols collapse/expand the tree/
 subtree.
 Anyway it would be nice to have an option where I can enable/disable
 this behaviour without changing original code.

 in jquery.treeview.js (not packed)

 in function applyClasses

 comment out this code at the beginning of the function:
                         
 this.filter(:has(ul):not(:has(a))).find(span).click(function
 (event) {
                                 toggler.apply($(this).next());
                         }).add( $(a, this) ).hoverClass();

 On 9 Apr., 16:05, edik eduard.mar...@googlemail.com wrote:



  I'm too searching for a way to change theclickbehaviour of the nodes
  (without touching the plugin-source), so that ONLY  +/- expands/
  collapses the node and not theclickon the SPAN element inside the LI-
  element.
  Anybody any suggestions?

  Thanks a lot

  On 10 Mrz., 21:04, Ryan grigg...@gmail.com wrote:

   Is there a way to make a node in thetreeviewexpand/collapse ONLY if
   the +/- is clicked but not the folder icon or folder name but still
   make the node selectable?


[jQuery] Event change on span/div

2009-04-14 Thread tommyy

Hi!

Anyone know how I can bind an event like change to the text inside a
span or div?


[jQuery] XSLT with anchors

2009-04-14 Thread Jonathan Maddison

Hello,

I am using the jQuery Transform plugin to perform XSL transforms. It
works great except when I load a page with an anchor.

i.e.

mysite.com/mypage

works fine, but -

mysite.com/mypage#xyz

gives incorrect output (all HTML tags are missing).

Does anybody have any idea what could be going wrong?


[jQuery] Calling a function from a non-jQuery .JS file

2009-04-14 Thread kiusau

I am new to jQuery, but understand enough to have already begun
targeted experimentation.  I have run into a snag.  In brief, I am
trying to call a function from a .JS file that contains no jQuery and
assign it to an HTML tag in a Dreamweaver template via jQuery that is
located in a different .JS file.  The code is as follows:

JQUERY CODE
$(document).ready(function() {
   $(div).filter(#today).toDate();
});

The expression toDate() is the function that I try to call.


MY DREAMWEAVER TEMPLATE (HEAD TAG)
script type=text/javascript src=http://ajax.googleapis.com/ajax/
libs/jquery/1.3/jquery.min.js/script
script type=text/javascript src=imagine.js/script
script type=text/javascript src=primer.js/script

MY DREAMWEAVER TEMPLATE (BODY TAG)
div id=today/div


The FUNCTION in MY NON-JQUERY .JS FILE
function toDate() {
var someDay = new Date();
var anyDay = new Array();
var anyMonth = new Array();

anyDay[0] = Sunday;
anyDay[1] = Monday;
anyDay[2] = Tuesday;
anyDay[3] = Wednesday;
anyDay[4] = Thursday;
anyDay[5] = Friday;
anyDay[6] = Saturday;

anyMonth[0] = January;
anyMonth[1] = February;
anyMonth[2] = March;
anyMonth[3] = April;
anyMonth[4] = May;
anyMonth[5] = June;
anyMonth[6] = July;
anyMonth[7] = August;
anyMonth[8] = September;
anyMonth[9] = October;
anyMonth[10] = November;
anyMonth[11] = December;

document.write(pToday's Date:br / + anyDay[someDay.getDay()] +
,  + someDay.getDate() +   + anyMonth[someDay.getMonth()] +   +
someDay.getFullYear() + /p);
}

Can you find my error?  If so, can you explain what I am doing wrong
and explain how to overcome it?

Roddy Stegemann


[jQuery] Re: Adding incremental numbered classes to divs

2009-04-14 Thread Eric Garside

I just finished documentation on a new plugin I think might help you
in this situation. Check out: http://eric.garside.name/docs.html?p=replicator

On Apr 13, 11:04 pm, Brain Lava nic...@brainlava.com wrote:
 Thanks everyone!  You've definitely made some great points for me to
 consider.  I'm really new to scripting (normally I can find plugins to
 do what I want) and you're probably right that there is a much easier
 solution to what I'm trying to achieve.

 I'm going to take your suggestions and see what I can figure out on my
 own.  If I can achieve the effect I'm desiring I'll post the end
 result for some feedback.

 Cheers!

 On Apr 9, 5:54 pm, mkmanning michaell...@gmail.com wrote:



  Since you're not using the class for styling, but indexing, why not
  just use the natural index of the div in its container, or from the
  jQuery object itself?

  $('.ngg-gallery-thumbnail-box') is an array-like object, so you can
  iterate over it, or access its members by index number, such as $
  ('.ngg-gallery-thumbnail-box').get(8).

  If you're building a carousel, adding incremental numbers to the
  classname to drive the carousel seems overkill.

  On Apr 9, 11:54 am, Brain Lava nic...@brainlava.com wrote:

   Normally I would agree with you but the effect I'm trying to achieve
   is based on the location of the image in the grid and not tied to the
   image itself.  I don't want the end user to have to update the CSS
   every time they move an image or add a new one to their gallery.  This
   seemed like the best way to achieve my end result.

   On Apr 9, 9:37 am, brian bally.z...@gmail.com wrote:

That seems like you're fighting against the convention. Why create a
zillion classes when these same divs already have an incremented ID?
(The ID being the proper place to do this sort of thin, in the 1st
place)

On Thu, Apr 9, 2009 at 1:31 AM, Brain Lava nic...@brainlava.com wrote:

 I'm really new to jQuery and have been struggling with a concept that
 I would think is pretty simple but I can't seem to find anything
 online that does what I need.

 I'm using NextGen Gallery for Wordpress and I would like to assign an
 incremental class to each div that the gallery outputs.  For example
 the gallery gives me the following code:

 div id=ngg-gallery-1 class=ngg-galleryoverview
   div id=ngg-image-99 class=ngg-gallery-thumbnail-box/div
   div id=ngg-image-55 class=ngg-gallery-thumbnail-box/div
   div id=ngg-image-95 class=ngg-gallery-thumbnail-box/div
 /div

 What I would like to do is replace the append class of the interior
 divs with a number that automatically increments by 1:
 div id=ngg-gallery-1 class=ngg-galleryoverview
   div id=ngg-image-99 class=ngg-gallery-thumbnail-box-1/div
   div id=ngg-image-55 class=ngg-gallery-thumbnail-box-2/div
   div id=ngg-image-95 class=ngg-gallery-thumbnail-box-3/div
 /div

 I've seen this done in carousel scripts but I can't seem to figure out
 how they do it.

 Any help would be greatly apprecaited.


[jQuery] Re: Getting index of clicked table cell

2009-04-14 Thread MorningZ

Thomas:

Thanks!  a big doh! for me for missing the fact that i wasn't
selecting table cells to find the cell clicked.  works like a
charm now.. .thanks


[jQuery] Re: Calling a function from a non-jQuery .JS file

2009-04-14 Thread MorningZ

So what is the error?

And realize something:  jQuery *is* JavaScript, don't think of it like
two different things

On Apr 14, 4:21 am, kiusau kiu...@mac.com wrote:
 I am new to jQuery, but understand enough to have already begun
 targeted experimentation.  I have run into a snag.  In brief, I am
 trying to call a function from a .JS file that contains no jQuery and
 assign it to an HTML tag in a Dreamweaver template via jQuery that is
 located in a different .JS file.  The code is as follows:

 JQUERY CODE
 $(document).ready(function() {
    $(div).filter(#today).toDate();

 });

 The expression toDate() is the function that I try to call.

 MY DREAMWEAVER TEMPLATE (HEAD TAG)
 script type=text/javascript src=http://ajax.googleapis.com/ajax/
 libs/jquery/1.3/jquery.min.js/script
 script type=text/javascript src=imagine.js/script
 script type=text/javascript src=primer.js/script

 MY DREAMWEAVER TEMPLATE (BODY TAG)
 div id=today/div

 The FUNCTION in MY NON-JQUERY .JS FILE
 function toDate() {
 var someDay = new Date();
 var anyDay = new Array();
 var anyMonth = new Array();

 anyDay[0] = Sunday;
 anyDay[1] = Monday;
 anyDay[2] = Tuesday;
 anyDay[3] = Wednesday;
 anyDay[4] = Thursday;
 anyDay[5] = Friday;
 anyDay[6] = Saturday;

 anyMonth[0] = January;
 anyMonth[1] = February;
 anyMonth[2] = March;
 anyMonth[3] = April;
 anyMonth[4] = May;
 anyMonth[5] = June;
 anyMonth[6] = July;
 anyMonth[7] = August;
 anyMonth[8] = September;
 anyMonth[9] = October;
 anyMonth[10] = November;
 anyMonth[11] = December;

 document.write(pToday's Date:br / + anyDay[someDay.getDay()] +
 ,  + someDay.getDate() +   + anyMonth[someDay.getMonth()] +   +
 someDay.getFullYear() + /p);

 }

 Can you find my error?  If so, can you explain what I am doing wrong
 and explain how to overcome it?

 Roddy Stegemann


[jQuery] [Validate] Custom error message for a group of fields

2009-04-14 Thread Bizzy

Hi,

let's take this example :

$(#myform).validate({
  groups: {
username: fname lname
  },
  errorPlacement: function(error, element) {
 if (element.attr(name) == fname
 || element.attr(name) == lname )
   error.insertAfter(#lastname);
 else
   error.insertAfter(element);
   },
   debug:true
 })

I want to c$(#myform).validate({
  groups: {
username: fname lname
  },
  errorPlacement: function(error, element) {
 if (element.attr(name) == fname
 || element.attr(name) == lname )
   error.insertAfter(#lastname);
 else
   error.insertAfter(element);
   },
   debug:true
 })

If i want to declare a custom message that will be shown for the whole
goup if one of the group elements is not filled ?
thanks in advance!


[jQuery] Event binding in frames

2009-04-14 Thread crawfjs

Hello,

In order to create a decoupled UI, I wanted to make the events within
some iframes write to the DOM (within the iframe).  Then from the main
container (top window), I created an observer to detect a 'change' on
that hidden element (in iframe) and respond appropriately.  I don't
want each control to be forced to handle the change of other
controls / components.  It should only be responsible only for itself
and to provide the data/changes as requested.

Example Code:

$('#left-column-frame').ready( function() {
$
('#selectedNodePath',window.frames.leftcolumnframe).click(function() {
alert('clicked');
});
});

$('#left-column-frame').ready( function() {
$
('#selectedNodePath',window.frames.leftcolumnframe).bind( 'click',
function() {
alert('changed');
});
});

... etc

While the above code is not throwing any errors, basically, nothing is
happening.

Respectfully,
John


[jQuery] Re: jQuery.support -- No direct support for IE6 detection

2009-04-14 Thread theJorn

Obviously I agree that IE6 should be banned. But since most big
corporations (and clients) still use it, I as a front-end developer
find that we need to keep supporting it.

But indeedly, conditional statements are once again the key.
Add this to the head of your page:
!--[if ie 6]
script
document.getElementsByTagName(html)[0].className += ( ie6);
/script
![endif]--

This adds the classname .ie6 to the html tag. Easy to check for this
in your scripts.
For some sites I use this to set the class .js aswell, so you can do
CSS tricks like .js .hide to hide elements if users have javascript.

Remember to put all the other JS just before the /body tag so it
won't interfere with the loading of the rest of your document.

.Jorn


On 7 apr, 05:02, RobG rg...@iinet.net.au wrote:
 On Apr 7, 7:33 am, Joe McCann joseph.is...@gmail.com wrote:

  Ricardo,

  I see your point now.  I was under the impression $.browser was
  becoming deprecated so $.support would take it's place.  But given the
  fact that I currently need to run one method forIE6, I will continue
  to use the $.browser method.

 If you describe the reason you are trying to specifically detect IE 6,
 you might discover a work around that doesn't require it.

  In regards to conditional comments, this becomes a performance issue
  where an additional JavaScript request is made on the server and has
  to download, impacting page load speed.

 There is no need for a separate file - and even if there was, the
 extra download will likely go unnoticed.  Non-IE 6 users certainly
 won't notice.

   I would rather take my
  chances with a browser sniff in one JS file than have to load an
  additional JS file AND maintain that JS file.

 You have to maintain the code anyway, besides, the conditional comment
 can be used to set a global variable without the need to load a
 separate file.  The only difference is that a conditional comment is
 used to detect the browser rather than the user agent string.

 --
 Rob


[jQuery] Converting JSON to html output

2009-04-14 Thread Nando

Hi,

I'm a jQuery and Javascript noob, and can't seem to get this to work.
The JSON output looks right to me via console.log(result), but the
select box isn't being populated. The select box needs to be populated
onfocus, because the interface is set up to allow the user to add new
options to the select via a popup without a page refresh.

$(function() {

  $.getJSON('index.cfm?view=listReferenceJSON',
function(result,status) {
  console.log(result)
  var str = ''
  for(var i=0; i  result.ROWCOUNT; i++) {
str+= 'option value='+result.DATA.REFERENCEID[i]
+''+result.DATA.AUTHOR[i]+' ('+result.DATA.REFYEAR[i]+')option'
  }
$(refSelectBox).bind('focus', function(event, ui) {
  $(#refSelectBox).html(str)
}
});
});

select id=refSelectBox/select

Thanks in advance for any help.

Nando


[jQuery] Re: Converting JSON to html output

2009-04-14 Thread MorningZ

Can you give an example of the JSON to help?


On Apr 14, 9:24 am, Nando d.na...@gmail.com wrote:
 Hi,

 I'm a jQuery and Javascript noob, and can't seem to get this to work.
 The JSON output looks right to me via console.log(result), but the
 select box isn't being populated. The select box needs to be populated
 onfocus, because the interface is set up to allow the user to add new
 options to the select via a popup without a page refresh.

 $(function() {

   $.getJSON('index.cfm?view=listReferenceJSON',
     function(result,status) {
       console.log(result)
       var str = ''
       for(var i=0; i  result.ROWCOUNT; i++) {
         str+= 'option value='+result.DATA.REFERENCEID[i]
 +''+result.DATA.AUTHOR[i]+' ('+result.DATA.REFYEAR[i]+')option'
       }
         $(refSelectBox).bind('focus', function(event, ui) {
           $(#refSelectBox).html(str)
         }
     });

 });

 select id=refSelectBox/select

 Thanks in advance for any help.

 Nando


[jQuery] Re: Converting JSON to html output

2009-04-14 Thread Nando

Sure. Here's the JSON string being returned by the server. The only
thing that will need some fiddling is that the year is being returned
as a float. Not sure how to get that displayed as just an integer in
JS.

{COLUMNS:
[REFERENCEID,AUTHOR,DETAIL,REFYEAR,REFTYPE],DATA:[[1,Chen
 Chen,Chinese Herbs and Recipes, Second Revision,2009.0,1],
[16,Dana Cat,,,1],[5,Simon Becker,Chinese Medicine Today,
2008.0,1],[14,tom cat,,2009.0,1],[4,Becker, Simon,Chinese
Medicine Today,2009.0,2],[3,Dana,Dana's Secret Pasta Recipe,
2008.0,5],[15,bob cat,,2007.0,5]]}

On Apr 14, 4:32 pm, MorningZ morni...@gmail.com wrote:
 Can you give an example of the JSON to help?

 On Apr 14, 9:24 am, Nando d.na...@gmail.com wrote:

  Hi,

  I'm a jQuery and Javascript noob, and can't seem to get this to work.
  The JSON output looks right to me via console.log(result), but the
  select box isn't being populated. The select box needs to be populated
  onfocus, because the interface is set up to allow the user to add new
  options to the select via a popup without a page refresh.

  $(function() {

    $.getJSON('index.cfm?view=listReferenceJSON',
      function(result,status) {
        console.log(result)
        var str = ''
        for(var i=0; i  result.ROWCOUNT; i++) {
          str+= 'option value='+result.DATA.REFERENCEID[i]
  +''+result.DATA.AUTHOR[i]+' ('+result.DATA.REFYEAR[i]+')option'
        }
          $(refSelectBox).bind('focus', function(event, ui) {
            $(#refSelectBox).html(str)
          }
      });

  });

  select id=refSelectBox/select

  Thanks in advance for any help.

  Nando


[jQuery] Re: [autocomplete] charset

2009-04-14 Thread Tom Worster

On 4/14/09 4:36 AM, borutt borut.toma...@gmail.com wrote:

 I'm having problem with charset on searching value, that is returned
 in param q.
 On main page and od page from where script search for data I have
 charset placed:
 
 main script:
 meta HTTP-EQUIV='Content-Type' Content='text-html;
 charset=windows-1250'

was the page with the form containing the input element explicitly served
with header Content-Type: text/html; charset=Windows-1250? (i check
headers sent in WebKit Inspector, i'm sure there are other ways.)

have you set the accept-charset attribute in the form?

if using php on the back end: have you set php's default_charset config
variable? are you using anything to encode the results sent from the search
script, e.g. htmlspecialchars() -- don't!

if using apache, have you checked that Windows-1250 is loaded as?


 search script:
 header( Content-Type: text/html; charset=Windows-1250 );

jquery.autocomplete expects plain text back, so Content-Type: text/plain;
charset=Windows-1250 might work better.


 I get some wierd characters when I use unicode characted like š,č,ž.

those characters appear in Windows-1250 and ISO 8859-2 in addition to
unicode.




[jQuery] Should $(document).ready() be external? And should it be placed at the bottom of the page?

2009-04-14 Thread kgosser

Hey all,

Two quick questions for you. I couldn't find the answers while
searching... This would be a great thing to add to the jQuery FAQ, by
the way.


(1) Is it advisable to place a page's $(document).ready() stuff in an
external .js file?

I've been doing a lot of reading and research on optimizing my front
end code, and YSlow seems to make a big deal of placing code
externally if possible for caching reasons. I understand the
usefulness of placing the code in an external document for that
reason, however, the problem is that there are a lot of functions for
button and link clicks, shows/hides, etc., that are unique to that
page and used differently on other pages.

Thus, putting it externally means it would most likely have to be in
an independent file just for that page... which means an added HTTP
request which is really the speed killer.

So anyways, looking for thoughts on this one.


(2) Is it advisable to place the $(document).ready() at the bottom of
the page right before the closing BODY tag?

Also when doing my research, I've seen that YSlow makes a big deal of
this as well. I'm sure many of you on here have discussed it or
thought about it yourself.

My question though is does it make sense to put the ready() code at
the bottom? Does it help? Is it useful? Will it break?


Thanks in advance for any feedback. Take care everyone.


[jQuery] Re: Should $(document).ready() be external? And should it be placed at the bottom of the page?

2009-04-14 Thread Andy Matthews

You can externalize the document.ready call if you choose, I do it all the
time.

As for putting it at the bottom of the page, I'd say no. Putting it in an
external JS file, with the ready call makes it so that code is not run until
the entire DOM is ready anyway.


andy 

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of kgosser
Sent: Tuesday, April 14, 2009 10:28 AM
To: jQuery (English)
Subject: [jQuery] Should $(document).ready() be external? And should it be
placed at the bottom of the page?


Hey all,

Two quick questions for you. I couldn't find the answers while searching...
This would be a great thing to add to the jQuery FAQ, by the way.


(1) Is it advisable to place a page's $(document).ready() stuff in an
external .js file?

I've been doing a lot of reading and research on optimizing my front end
code, and YSlow seems to make a big deal of placing code externally if
possible for caching reasons. I understand the usefulness of placing the
code in an external document for that reason, however, the problem is that
there are a lot of functions for button and link clicks, shows/hides, etc.,
that are unique to that page and used differently on other pages.

Thus, putting it externally means it would most likely have to be in an
independent file just for that page... which means an added HTTP request
which is really the speed killer.

So anyways, looking for thoughts on this one.


(2) Is it advisable to place the $(document).ready() at the bottom of the
page right before the closing BODY tag?

Also when doing my research, I've seen that YSlow makes a big deal of this
as well. I'm sure many of you on here have discussed it or thought about it
yourself.

My question though is does it make sense to put the ready() code at the
bottom? Does it help? Is it useful? Will it break?


Thanks in advance for any feedback. Take care everyone.




[jQuery] Re: Converting JSON to html output

2009-04-14 Thread Andy Matthews

ColdFusion JSON represent!
 

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Nando
Sent: Tuesday, April 14, 2009 9:51 AM
To: jQuery (English)
Subject: [jQuery] Re: Converting JSON to html output


Sure. Here's the JSON string being returned by the server. The only thing
that will need some fiddling is that the year is being returned as a float.
Not sure how to get that displayed as just an integer in JS.

{COLUMNS:
[REFERENCEID,AUTHOR,DETAIL,REFYEAR,REFTYPE],DATA:[[1,Chen
 Chen,Chinese Herbs and Recipes, Second Revision,2009.0,1], [16,Dana
Cat,,,1],[5,Simon Becker,Chinese Medicine Today, 2008.0,1],[14,tom
cat,,2009.0,1],[4,Becker, Simon,Chinese Medicine
Today,2009.0,2],[3,Dana,Dana's Secret Pasta Recipe, 2008.0,5],[15,bob
cat,,2007.0,5]]}

On Apr 14, 4:32 pm, MorningZ morni...@gmail.com wrote:
 Can you give an example of the JSON to help?

 On Apr 14, 9:24 am, Nando d.na...@gmail.com wrote:

  Hi,

  I'm a jQuery and Javascript noob, and can't seem to get this to work.
  The JSON output looks right to me via console.log(result), but the 
  select box isn't being populated. The select box needs to be 
  populated onfocus, because the interface is set up to allow the user 
  to add new options to the select via a popup without a page refresh.

  $(function() {

    $.getJSON('index.cfm?view=listReferenceJSON',
      function(result,status) {
        console.log(result)
        var str = ''
        for(var i=0; i  result.ROWCOUNT; i++) {
          str+= 'option value='+result.DATA.REFERENCEID[i]
  +''+result.DATA.AUTHOR[i]+' ('+result.DATA.REFYEAR[i]+')option'
        }
          $(refSelectBox).bind('focus', function(event, ui) {
            $(#refSelectBox).html(str)
          }
      });

  });

  select id=refSelectBox/select

  Thanks in advance for any help.

  Nando




[jQuery] Re: XSLT with anchors

2009-04-14 Thread Benjamin Sterling
Jonathon,
Is there a url or some code (pastebin.com) that we can look at?

Benjamin Sterling / Web Developer
kenzomedia.com / kenzohosting.com / benjaminsterling.com / refreshbmore.org

443.844.7654 // Twitter @bmsterling
Skype: benjamin.sterling // AIM: thekenzoco


On Tue, Apr 14, 2009 at 4:52 AM, Jonathan Maddison jma...@gmail.com wrote:


 Hello,

 I am using the jQuery Transform plugin to perform XSL transforms. It
 works great except when I load a page with an anchor.

 i.e.

 mysite.com/mypage

 works fine, but -

 mysite.com/mypage#xyz

 gives incorrect output (all HTML tags are missing).

 Does anybody have any idea what could be going wrong?



[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery

2009-04-14 Thread jscripter

Hi,

Here are my testing results:

IE7: table cells highlight to yellow when checkboxes are checked, but
don't go back to black when unchecked;
  same issue with ul list items (highlighting stuck on pink)

Opera 9.64: same highlight problem that IE7 has

Chrome 2.0.169.1: dragging in cells just selects text; checking/
unchecking checkboxes doesn't change background in either the table or
ul list. (I think some javascript is not getting run)

Firefox 3.0.8: basically works as expected; only nit is that the
cursor changes to a text insertion bar when over the labels. Perhaps
this can be fixed with style=cursor: default ???

(Note: IE7, Chrome and Firefox have the cursor changing to an
insertion bar when over the checkbox label; only in Opera does the
cursor stay as an arrow pointer.)

Thanks again for your work on this.

ER

On Apr 14, 3:31 am, Lwangaman donjohn.f...@gmail.com wrote:
 Latest:http://jsbin.com/isuga/edit
 Simplified the code for the highlighting process and corrected the
 case-possibility that first parameter is left empty (in that case, all
 child checkboxes are involved).

 Empty parameter usage:
 $('table').dragCheck()
 for no parameters;
 $('table').dragCheck('', 'pink')
 for empty first parameter.
 Second parameter can be left out completely.

 On 14 Apr, 09:45, Lwangaman donjohn.f...@gmail.com wrote:



  Ok latest version I've included the possibility of adding a background
  color:http://jsbin.com/icena/edit

  The background color is specified as a second parameter in the
  function:
  $('table').dragCheck('td:not(.nono) :checkbox', 'pink')

  To clear the dragCheck:
  $('table').dragCheck('clear')

  On 13 Apr, 23:29, jscripter pc88m...@gmail.com wrote:

   Here's what I'm shooting for:

  http://jsbin.com/izoce/edit

   It's basically the same code as found on cross-browser.com, but I've
   added the cell highlighting.

   Works under Firefox, Opera and Chrome. It should also work under IE,
   but it doesn't seem to work when on the jsbin.com site. However, if
   you just download it and run it from a local file it should work for
   you.

   The text selection bug is basically fixed. It is still possible to
   select text if the mousedown event occurs in the right place between
   cells. I don't think text selection is possible if the border width is
   set to 0 (but then you also don't get a border.)

   On Apr 13, 2:30 pm, Lwangaman donjohn.f...@gmail.com wrote:

I think I've done it.

   http://jsbin.com/adixe/edit

I have also left out the mouseleave event, and applied the mouseup to
the whole document instead of to the table, that way even if I leave
the table but still have the mouse button down, I don't lose the value
in the variable. Only if I let go of the mouse button (on or off the
table) do I reset the variable.

@Ricardo and @jscripter: does this work good?

On 13 Apr, 14:41, Lwangaman donjohn.f...@gmail.com wrote:

 I tried working on it again and made a little progress... Now I got
 parent and child selected correctly, but I don't have mouseover
 working for some reason...

http://jsbin.com/avigi/edit

 On 13 Apr, 02:43, Lwangaman donjohn.f...@gmail.com wrote:

  One more detail: mouseout should not take effect until mouseup.
  In fact, right now, if I click and begin to drag, then still holding
  the mouse button I leave the area, and still holding it come back 
  over
  the cells, they no longer get checked / unchecked because mouseout 
  has
  already kicked in. Instead it shouldn't kick in until I actually let
  go of the mouse button, and I could let go of it anywhere on the 
  page
  I suppose, so I guess mouseup would have to be applied to the 
  whole
  document.

  On 13 Apr, 02:33, Lwangaman donjohn.f...@gmail.com wrote:

   I tried something along those lines...

  http://jsbin.com/ehedu/edit

   But I just don't have the hang of using this correctly and 
   knowing
   when to refer to dom elements as dom elements or as jquery 
   objects...

   The idea is to tie all events to the container of the checkboxes 
   (i.e.
   table cells), and not to the external container (table or ul list 
   or
   whatever), and yet be able to read and write the value of the
   checkboxes...

   On 13 Apr, 01:13, Lwangaman donjohn.f...@gmail.com wrote:

Taking up jscripter's suggestion, I just noticed myself that 
applying
the mousedown and mouseover to the whole table keeps you from 
being
able to click on any links that may be contained in the table. 
For
example my table has links in the header cells that when clicked
reorder the table according to that column. Now I can no longer 
click
them...
And, as jscripter says, in the X-Library the mousedown and 
mouseover
was applied to the cells containing the checkboxes 

[jQuery] Re: Should $(document).ready() be external? And should it be placed at the bottom of the page?

2009-04-14 Thread kgosser

So do you think placing it in an external file poses caching benefits
that outweigh the extra HTTP request? The number of HTTP requests
seems to be the biggest killer with speed

On Apr 14, 10:34 am, Andy Matthews li...@commadelimited.com wrote:
 You can externalize the document.ready call if you choose, I do it all the
 time.

 As for putting it at the bottom of the page, I'd say no. Putting it in an
 external JS file, with the ready call makes it so that code is not run until
 the entire DOM is ready anyway.

 andy

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

 Behalf Of kgosser
 Sent: Tuesday, April 14, 2009 10:28 AM
 To: jQuery (English)
 Subject: [jQuery] Should $(document).ready() be external? And should it be
 placed at the bottom of the page?

 Hey all,

 Two quick questions for you. I couldn't find the answers while searching...
 This would be a great thing to add to the jQuery FAQ, by the way.

 (1) Is it advisable to place a page's $(document).ready() stuff in an
 external .js file?

 I've been doing a lot of reading and research on optimizing my front end
 code, and YSlow seems to make a big deal of placing code externally if
 possible for caching reasons. I understand the usefulness of placing the
 code in an external document for that reason, however, the problem is that
 there are a lot of functions for button and link clicks, shows/hides, etc.,
 that are unique to that page and used differently on other pages.

 Thus, putting it externally means it would most likely have to be in an
 independent file just for that page... which means an added HTTP request
 which is really the speed killer.

 So anyways, looking for thoughts on this one.

 (2) Is it advisable to place the $(document).ready() at the bottom of the
 page right before the closing BODY tag?

 Also when doing my research, I've seen that YSlow makes a big deal of this
 as well. I'm sure many of you on here have discussed it or thought about it
 yourself.

 My question though is does it make sense to put the ready() code at the
 bottom? Does it help? Is it useful? Will it break?

 Thanks in advance for any feedback. Take care everyone.


[jQuery] Re: [autocomplete] charset

2009-04-14 Thread borutt

 was the page with the form containing the input element explicitly served
 with header Content-Type: text/html; charset=Windows-1250? (i check
 headers sent in WebKit Inspector, i'm sure there are other ways.)

I have included in the html header this line:
meta HTTP-EQUIV='Content-Type' Content='text-html;
charset=windows-1250'

 have you set the accept-charset attribute in the form?

I have not I never did. Will try this tomorrow.

 if using php on the back end: have you set php's default_charset config
 variable? are you using anything to encode the results sent from the search
 script, e.g. htmlspecialchars() -- don't!

No. I tried in PHP with function iconv(), but that did not help
either.

 if using apache, have you checked that Windows-1250 is loaded as?

I'm using IIS.

 jquery.autocomplete expects plain text back, so Content-Type: text/plain;
 charset=Windows-1250 might work better.

I tried this but did not work either.

A assumed that goes something wrong with value after it is submited by
ajax.
Because when I receive value from q argument it's already scrambled.

Have any idea?

Thanks,
Borut Tomazin


[jQuery] Re: Converting JSON to html output

2009-04-14 Thread MorningZ

Well, just putting the JSON into a JSON viewer (this one is excellent:
http://www.codeplex.com/JsonViewer) you pasted into your last post

you have no property of .ROWCOUNT, so that's a bad start..

this is a quick mock up that works

http://paste.pocoo.org/show/112508/

(sorry about the if's... i never trust that the data is intact/
complete)


On Apr 14, 10:50 am, Nando d.na...@gmail.com wrote:
 Sure. Here's the JSON string being returned by the server. The only
 thing that will need some fiddling is that the year is being returned
 as a float. Not sure how to get that displayed as just an integer in
 JS.

 {COLUMNS:
 [REFERENCEID,AUTHOR,DETAIL,REFYEAR,REFTYPE],DATA:[[1,Chen
  Chen,Chinese Herbs and Recipes, Second Revision,2009.0,1],
 [16,Dana Cat,,,1],[5,Simon Becker,Chinese Medicine Today,
 2008.0,1],[14,tom cat,,2009.0,1],[4,Becker, Simon,Chinese
 Medicine Today,2009.0,2],[3,Dana,Dana's Secret Pasta Recipe,
 2008.0,5],[15,bob cat,,2007.0,5]]}

 On Apr 14, 4:32 pm, MorningZ morni...@gmail.com wrote:

  Can you give an example of the JSON to help?

  On Apr 14, 9:24 am, Nando d.na...@gmail.com wrote:

   Hi,

   I'm a jQuery and Javascript noob, and can't seem to get this to work.
   The JSON output looks right to me via console.log(result), but the
   select box isn't being populated. The select box needs to be populated
   onfocus, because the interface is set up to allow the user to add new
   options to the select via a popup without a page refresh.

   $(function() {

     $.getJSON('index.cfm?view=listReferenceJSON',
       function(result,status) {
         console.log(result)
         var str = ''
         for(var i=0; i  result.ROWCOUNT; i++) {
           str+= 'option value='+result.DATA.REFERENCEID[i]
   +''+result.DATA.AUTHOR[i]+' ('+result.DATA.REFYEAR[i]+')option'
         }
           $(refSelectBox).bind('focus', function(event, ui) {
             $(#refSelectBox).html(str)
           }
       });

   });

   select id=refSelectBox/select

   Thanks in advance for any help.

   Nando


[jQuery] Re: Calling a function from a non-jQuery .JS file

2009-04-14 Thread Klaus Hartl

On 14 Apr., 15:41, MorningZ morni...@gmail.com wrote:
 So what is the error

The error is obviously that toDate is not a jQuery method. Another
problem is that that Dreamweaver method is using document.write which
can cause a problem depending on where the function is being called
and which is usually avoided in jQuery land.

Since toDate is not (yet) a jQuery method, let's make one:

(function($) {

var days = [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
];

var months = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
];

$.fn.toDate = function() {
var now = new Date;
return this.html('pToday\'s Date:br /' + days[now.getDay
()] +
', ' + now.getDate() + ' ' + months[now.getMonth()] + ' 
' +
now.getFullYear() + '/p');
};

})(jQuery);


Now you can use it like:

$(document).ready(function() {
   $('#today').toDate();
});


--Klaus


[jQuery] Re: Calling a function from a non-jQuery .JS file

2009-04-14 Thread mkmanning

Your calling toDate() as a method on the jQuery object, which it
isn't; it's simply a function that prints out the date (and you should
maybe rethink the document.write, it's deprecated). If you want the
output to appear as the content of the element with id 'today' then do
something like

 $(div).filter(#today).text( toDate() );

On Apr 14, 1:21 am, kiusau kiu...@mac.com wrote:
 I am new to jQuery, but understand enough to have already begun
 targeted experimentation.  I have run into a snag.  In brief, I am
 trying to call a function from a .JS file that contains no jQuery and
 assign it to an HTML tag in a Dreamweaver template via jQuery that is
 located in a different .JS file.  The code is as follows:

 JQUERY CODE
 $(document).ready(function() {
    $(div).filter(#today).toDate();

 });

 The expression toDate() is the function that I try to call.

 MY DREAMWEAVER TEMPLATE (HEAD TAG)
 script type=text/javascript src=http://ajax.googleapis.com/ajax/
 libs/jquery/1.3/jquery.min.js/script
 script type=text/javascript src=imagine.js/script
 script type=text/javascript src=primer.js/script

 MY DREAMWEAVER TEMPLATE (BODY TAG)
 div id=today/div

 The FUNCTION in MY NON-JQUERY .JS FILE
 function toDate() {
 var someDay = new Date();
 var anyDay = new Array();
 var anyMonth = new Array();

 anyDay[0] = Sunday;
 anyDay[1] = Monday;
 anyDay[2] = Tuesday;
 anyDay[3] = Wednesday;
 anyDay[4] = Thursday;
 anyDay[5] = Friday;
 anyDay[6] = Saturday;

 anyMonth[0] = January;
 anyMonth[1] = February;
 anyMonth[2] = March;
 anyMonth[3] = April;
 anyMonth[4] = May;
 anyMonth[5] = June;
 anyMonth[6] = July;
 anyMonth[7] = August;
 anyMonth[8] = September;
 anyMonth[9] = October;
 anyMonth[10] = November;
 anyMonth[11] = December;

 document.write(pToday's Date:br / + anyDay[someDay.getDay()] +
 ,  + someDay.getDate() +   + anyMonth[someDay.getMonth()] +   +
 someDay.getFullYear() + /p);

 }

 Can you find my error?  If so, can you explain what I am doing wrong
 and explain how to overcome it?

 Roddy Stegemann


[jQuery] Slideshow with Carousel and spotlight?

2009-04-14 Thread amuhlou

Hi everyone,

I'm looking for an image slideshow using carousel thumbnails as well
as a spotlight for an enlarged version of the thumbnails. YUI has one
that *almost* does what I need (http://developer.yahoo.com/yui/
examples/carousel/csl_dynload2_clean.html), however it doesn't allow
for portrait or landscape thumbnails. Plus, I like jquery better! I've
done a lot of googling and have come up with nothing that is quite
right.

I was just wondering if anyone has come across something like this for
jQuery that has:
--Ajax for loading the images
--support for portrait  landscape thumbnails (or just unrestrictive
enough so that I can use css to tweak it)
--multiple carousels on one page.

I tried to mashup the Cycle plugin and jCarousel, but got stuck when I
couldn't get the thumbnails to load dynamically.(ex:
http://static.spartaninternet.com/sandbox/carousel2/)

Any suggestions would be greatly appreciated!


[jQuery] Re: Final Four: Grabbing Keys, Styling Columns, Pop Up Forms, Edit Select Lists?

2009-04-14 Thread briandus

Hi Tony -

#1) thanks so much for the hint on the readonly field. I must have
missed that one in the documentation; works perfectly! Howover, the
row placement being the value of the id that is being sent is
obviously a problem as I can't use that to manipulate my database
records. Unfortunately, I can't change the field name in the database
which is named ID and I'm using VB.NET on the backend which isn't
case sensitive. So, I'm having a conflict between the id and the
ID. But, I have ID defined like this in the colModel:

{ name: ID, width: 3, hidden: true, key: true, sorttype: 'int',
editable: true, editrules: { searchhidden: true, index: 'ID', jsonmap:
'ID' }, editoptions: { readonly: true} }

 I was thinking maybe I could just send this field as an extra
parameter or something. But, isn't the key attribute what should
make it the id ?


#2) I am using FF primarily, but am testing along in IE 6 and 7 as I
move forward. Yesterday, it was the Add record form that was always
popped open when I opened the page, but since then I added a show/hide
column window and now it's the one that's showing up on each page
request. I'm assuming it has something to do with the way I am trying
to implement the method. I just have it tacked on at the end, instead
of being inside an event. I guess I need to attach it to a click event
instead.
  }).$(#searchFields).filterGrid(#mygrid, { gridModel: true,
gridNames: true, formtype: vertical, enableSearch: true,
enableClear: true, autosearch: true });


#3) Sorry to hear about the column styling, but I'll be looking
forward to seeing your new features for that in the future.

#4)  I have a large grid (about 165 lines)  so I'm not sure how you
want me to send it. Do you want me to send all of the grid
configuration or just a piece of it? Here is an example of how I have
defined one column that needed a select list on the edit form:

{ name: InterchangeVersion, width: 25, resizable: true, sortable:
true, sorttype: 'text', editable: true, edittype: 'select',
editoptions: { value: 004010X098A1:4010 Prof A1;004010X097A1:4010
Dental A1;004010X096A1:4010 Inst A1;004010X098A:4010 Prof;004010X097A:
4010 Dental;004010X096A:4010 Inst }, editrules: { required: true,
index: 'InterchangeVersion', jsonmap: 'InterchangeVersion', label:
'InterchangeVersion', resizable: true, search: true} },

The value held in the database (and displayed in the grid) is the
value on the left of the colon. The text to show in the dropdown is
the right side. Is this correct?


#5 ) The other thing I was going to ask also is that on my pager, I
have 7 total records, but it shows 14. Yesterday it was doing the same
thing. I had the records per page set to 3 and there were a total of 5
records, but the pager showed 8. And, it always shows page 1 of 0. I
was using alert's after the json string was read and it alerts the
correct number of pages, so I was just curious what I may be doing
wrong there and what I could look for.



Thanks so much!!


On Apr 14, 2:44 am, Tony t...@trirand.com wrote:
 Hello,

 #1)
 colModel : [
 { name:ID, hidden:true, editable:true, editrules:{edithidden:true},
 editoptions:{readonly:true} },
 ..
 ]
 Look into the docs for more details.

 #2) In wich browser is this?

 #3) Currently not possible. It is hardcoded in the source. Will try to
 put this in the css
 in order to be customisable.

 #4) Could youi plese the grid configuration and piece of data that is
 populated
 in the grid.

 Regards
 Tony

 On Apr 14, 2:01 am, briandus bri...@virtual-essentials.com wrote:

  Hi there -  I am using jqGrid with ASP.NET and while it has really
  taken me quite some time to get this integration playing nicely, now
  that I've finally got things moving, I am so pleased. But, I have four
  things that I am still having some trouble with...

  #1)
  I have a table with some hidden fields...the key field is hidden and
  named (ID). In order to get the field to send along with the rest of
  the edit parameters, I had to show the field, but then it shows up as
  editable on the form. When I set 'editable' to false, it no longer
  exists on the field. More importantly, however, is that there is a
  lower case id being sent along with the oper parameter. The id
  field being passed is the row id in the table, not the key field. How
  can I grab and pass the key field?

  #2)
  Since I have enabled editing, everytime I refresh my page, the Add
  record Dialog Box always displays. How can I turn this off?

  #3)
  How can I style the checkbox column as well as the column with the
  Plus sign icon indicating a sub grid? Both of these columns are much
  wider than they need to be.

  #4)
  When I edit a record, the select lists are dynamically populated with
  the correct values as per the colModel, but they are not the existing
  values on the record. For example, if I am editing a record with a
  field value of ON, the edit form shows a select list with OFF and
  ON, but the selected value is OFF...rather 

[jQuery] Re: Final Four: Grabbing Keys, Styling Columns, Pop Up Forms, Edit Select Lists?

2009-04-14 Thread briandus

Hi Tony -

#1) thanks so much for the hint on the readonly field. I must have
missed that one in the documentation; works perfectly! Howover, the
row placement being the value of the id that is being sent is
obviously a problem as I can't use that to manipulate my database
records. Unfortunately, I can't change the field name in the database
which is named ID and I'm using VB.NET on the backend which isn't
case sensitive. So, I'm having a conflict between the id and the
ID. But, I have ID defined like this in the colModel:

{ name: ID, width: 3, hidden: true, key: true, sorttype: 'int',
editable: true, editrules: { searchhidden: true, index: 'ID', jsonmap:
'ID' }, editoptions: { readonly: true} }

 I was thinking maybe I could just send this field as an extra
parameter or something. But, isn't the key attribute what should
make it the id ?


#2) I am using FF primarily, but am testing along in IE 6 and 7 as I
move forward. Yesterday, it was the Add record form that was always
popped open when I opened the page, but since then I added a show/hide
column window and now it's the one that's showing up on each page
request. I'm assuming it has something to do with the way I am trying
to implement the method. I just have it tacked on at the end, instead
of being inside an event. I guess I need to attach it to a click event
instead.
  }).$(#searchFields).filterGrid(#mygrid, { gridModel: true,
gridNames: true, formtype: vertical, enableSearch: true,
enableClear: true, autosearch: true });


#3) Sorry to hear about the column styling, but I'll be looking
forward to seeing your new features for that in the future.

#4)  I have a large grid (about 165 lines)  so I'm not sure how you
want me to send it. Do you want me to send all of the grid
configuration or just a piece of it? Here is an example of how I have
defined one column that needed a select list on the edit form:

{ name: InterchangeVersion, width: 25, resizable: true, sortable:
true, sorttype: 'text', editable: true, edittype: 'select',
editoptions: { value: 004010X098A1:4010 Prof A1;004010X097A1:4010
Dental A1;004010X096A1:4010 Inst A1;004010X098A:4010 Prof;004010X097A:
4010 Dental;004010X096A:4010 Inst }, editrules: { required: true,
index: 'InterchangeVersion', jsonmap: 'InterchangeVersion', label:
'InterchangeVersion', resizable: true, search: true} },

The value held in the database (and displayed in the grid) is the
value on the left of the colon. The text to show in the dropdown is
the right side. Is this correct?


#5 ) The other thing I was going to ask also is that on my pager, I
have 7 total records, but it shows 14. Yesterday it was doing the same
thing. I had the records per page set to 3 and there were a total of 5
records, but the pager showed 8. And, it always shows page 1 of 0. I
was using alert's after the json string was read and it alerts the
correct number of pages, so I was just curious what I may be doing
wrong there and what I could look for.



Thanks so much!!


On Apr 14, 2:44 am, Tony t...@trirand.com wrote:
 Hello,

 #1)
 colModel : [
 { name:ID, hidden:true, editable:true, editrules:{edithidden:true},
 editoptions:{readonly:true} },
 ..
 ]
 Look into the docs for more details.

 #2) In wich browser is this?

 #3) Currently not possible. It is hardcoded in the source. Will try to
 put this in the css
 in order to be customisable.

 #4) Could youi plese the grid configuration and piece of data that is
 populated
 in the grid.

 Regards
 Tony

 On Apr 14, 2:01 am, briandus bri...@virtual-essentials.com wrote:

  Hi there -  I am using jqGrid with ASP.NET and while it has really
  taken me quite some time to get this integration playing nicely, now
  that I've finally got things moving, I am so pleased. But, I have four
  things that I am still having some trouble with...

  #1)
  I have a table with some hidden fields...the key field is hidden and
  named (ID). In order to get the field to send along with the rest of
  the edit parameters, I had to show the field, but then it shows up as
  editable on the form. When I set 'editable' to false, it no longer
  exists on the field. More importantly, however, is that there is a
  lower case id being sent along with the oper parameter. The id
  field being passed is the row id in the table, not the key field. How
  can I grab and pass the key field?

  #2)
  Since I have enabled editing, everytime I refresh my page, the Add
  record Dialog Box always displays. How can I turn this off?

  #3)
  How can I style the checkbox column as well as the column with the
  Plus sign icon indicating a sub grid? Both of these columns are much
  wider than they need to be.

  #4)
  When I edit a record, the select lists are dynamically populated with
  the correct values as per the colModel, but they are not the existing
  values on the record. For example, if I am editing a record with a
  field value of ON, the edit form shows a select list with OFF and
  ON, but the selected value is OFF...rather 

[jQuery] Re: [autocomplete] charset

2009-04-14 Thread Tom Worster

On 4/14/09 11:54 AM, borutt borut.toma...@gmail.com wrote:

 
 was the page with the form containing the input element explicitly served
 with header Content-Type: text/html; charset=Windows-1250? (i check
 headers sent in WebKit Inspector, i'm sure there are other ways.)
 
 I have included in the html header this line:
 meta HTTP-EQUIV='Content-Type' Content='text-html;
 charset=windows-1250'

that's not necessarily sufficient. if the the server sends, for example,
charset=ISO-8859-1 in the headers then the user agent should ignore the meta
HTTP-EQUIV. read this:

http://www.w3.org/TR/1999/REC-html401-19991224/charset.html#h-5.2.2


 have you set the accept-charset attribute in the form?
 
 I have not I never did. Will try this tomorrow.

this has even lower priority than the meta HTTP-EQUIV. if the http header
explicitly sets anything other than windows-1250 then that's what will take
effect in the user agent.


 A assumed that goes something wrong with value after it is submited by
 ajax.
 Because when I receive value from q argument it's already scrambled.
 
 Have any idea?

make sure the header of the form page specifies windows-1250.

check in your server logs to see exactly what the query string was in the
ajax request. compare that with what you receive in the script. if the query
string is correct but the input value in your script is wrong then it's
probably to do with configuration of your script interpreter. if the query
string received in the http server GET request is wrong then the user agent
is probably using the wrong charset.




[jQuery] Selecting radio buttons within different RadioGroups via a click

2009-04-14 Thread madrid440-goo...@yahoo.co.uk

I'm getting lost in selectors...


I am trying to achieve the following:
A button click needs to select certain radio buttons within different
radio groups. e.g RadioGroup1_0 and RadioGroup2_1

A click on another button resets the radio buttons to blank, and then
selects different radio buttons within those radio groups. e.g.
RadioGroup1_1 and RadioGroup2_2


input type=submit name=button1 id=button1 value=Selection1 /
input type=submit name=button2 id=button2 value=Selection2 /

labelinput type=radio name=RadioGroup1 value=0
id=RadioGroup1_0 /0/label
labelinput type=radio name=RadioGroup1 value=1
id=RadioGroup1_1 /1/label
labelinput type=radio name=RadioGroup1 value=2
id=RadioGroup1_2 /2/label

labelinput type=radio name=RadioGroup2 value=0
id=RadioGroup2_0 /0/label
labelinput type=radio name=RadioGroup2 value=1
id=RadioGroup2_1 /1/label
labelinput type=radio name=RadioGroup2 value=2
id=RadioGroup2_2 /2/label




[jQuery] Re: Bug in my gallery, wtf?!

2009-04-14 Thread Rey Bango

Without having access to the code it's hard to test it but it looks
like an event bubbling issue in the click binding for '#carousel_nav
a'. Could you try this:

$('#carousel_nav a').click(function(event)
{
event.stopPropagation();
c_slide($(this));
});

Rey...

On Apr 13, 9:56 pm, @oscargodson oscargod...@gmail.com wrote:
 Before I post a link:

 A. Yes, the code is messy, I have been trying to fix this all day, and
 I have restructured my code at least a dozen times, and that is why it
 is so messy, so please don't say try cleaning it up :)

 B. There are 100s of images, I just haven't sliced them all out from
 the client's PDF yet, so only pneumatic and vintage load a set of
 images.

 C. Thumbs don't match with the large images yet, because I haven't sat
 down and matched the 100s of images yet, but it works correctly! :)

 OK so on with it:http://boozker.com/beall/

 Everything works perfectly ON LOAD! :(

 If you click on my custom carousal everything works. thumbs, left, and
 right arrows work fine.

 The 1 step arrows (ones on the black bar) work fine and even update
 the count correctly.

 However, ALL of this breaks when I reload with a click like this:
 $('#gallery_nav ul a').click(function(){
                 var new_set = $(this).attr('title').toLowerCase();
                 $.get(js/get_images.php, { set:new_set }, function(data){
                                 $('#carousel_wrapper 
 ul').empty().append(data);
                                 activate_gallery();
                 });
         });

 Here is my window load:
 $.get(js/get_images.php, { set:'history' }, function(data){
                                 $('#carousel_wrapper 
 ul').empty().append(data);
                                 activate_gallery();
                 });

 After you click on a new category, it basically run activate_gallery
 (); twice, and so when you click next on either arrows it jumps x2. If
 you change the category 3x it jumps 3x etc

 I KNOW it has to do with activate_gallery but I have NO CLUE how else
 to write it. :(

 Remember, I have move code chunks all over. Does anyone have any ideas
 on how to get this to work?


[jQuery] Re: Should $(document).ready() be external? And should it be placed at the bottom of the page?

2009-04-14 Thread Andy Matthews

That's something that each developer has to evaluate on their own. I'd think
it depends on the size of the file, and how it's being served.

Better for SEO to have an external file, as content is now closer to the
top.
Better for the user to cache said file.

Maybe set your own personal threshold for size...if the file is over 5k,
externalize it?


andy

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of kgosser
Sent: Tuesday, April 14, 2009 10:52 AM
To: jQuery (English)
Subject: [jQuery] Re: Should $(document).ready() be external? And should it
be placed at the bottom of the page?


So do you think placing it in an external file poses caching benefits that
outweigh the extra HTTP request? The number of HTTP requests seems to be the
biggest killer with speed

On Apr 14, 10:34 am, Andy Matthews li...@commadelimited.com wrote:
 You can externalize the document.ready call if you choose, I do it all 
 the time.

 As for putting it at the bottom of the page, I'd say no. Putting it in 
 an external JS file, with the ready call makes it so that code is not 
 run until the entire DOM is ready anyway.

 andy

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
 On

 Behalf Of kgosser
 Sent: Tuesday, April 14, 2009 10:28 AM
 To: jQuery (English)
 Subject: [jQuery] Should $(document).ready() be external? And should 
 it be placed at the bottom of the page?

 Hey all,

 Two quick questions for you. I couldn't find the answers while
searching...
 This would be a great thing to add to the jQuery FAQ, by the way.

 (1) Is it advisable to place a page's $(document).ready() stuff in an 
 external .js file?

 I've been doing a lot of reading and research on optimizing my front 
 end code, and YSlow seems to make a big deal of placing code 
 externally if possible for caching reasons. I understand the 
 usefulness of placing the code in an external document for that 
 reason, however, the problem is that there are a lot of functions for 
 button and link clicks, shows/hides, etc., that are unique to that page
and used differently on other pages.

 Thus, putting it externally means it would most likely have to be in 
 an independent file just for that page... which means an added HTTP 
 request which is really the speed killer.

 So anyways, looking for thoughts on this one.

 (2) Is it advisable to place the $(document).ready() at the bottom of 
 the page right before the closing BODY tag?

 Also when doing my research, I've seen that YSlow makes a big deal of 
 this as well. I'm sure many of you on here have discussed it or 
 thought about it yourself.

 My question though is does it make sense to put the ready() code at 
 the bottom? Does it help? Is it useful? Will it break?

 Thanks in advance for any feedback. Take care everyone.




[jQuery] Re: Slideshow with Carousel and spotlight?

2009-04-14 Thread rick

Hi, Amy...just wanted to let you know that I'm looking for something
almost just like this...small thumbnails below and a large image above
in a slideshow/manual select configuration.

I hope there is a plug-in that someone knows about that will do this!


Rick


 Original Message Subject: [jQuery] Slideshow with Carousel and spotlight?From: amuhlou amysch...@gmail.comDate: Tue, April 14, 2009 9:04 amTo: "jQuery (English)" jquery-en@googlegroups.comHi everyone,I'm looking for an image slideshow using carousel thumbnails as wellas a spotlight for an enlarged version of the thumbnails. YUI has onethat *almost* does what I need (http://developer.yahoo.com/yui/examples/carousel/csl_dynload2_clean.html), however it doesn't allowfor portrait or landscape thumbnails. Plus, I like jquery better! I'vedone a lot of googling and have come up with nothing that is quiteright.I was just wondering if anyone has come across something like this forjQuery that has:--Ajax for loading the images--support for portrait  landscape thumbnails (or just unrestrictiveenough so that I can use css to tweak it)--multiple carousels on one page.I tried to mashup the Cycle plugin and jCarousel, but got stuck when Icouldn't get the thumbnails to load dynamically.(ex:http://static.spartaninternet.com/sandbox/carousel2/)Any suggestions would be greatly appreciated!


[jQuery] Form validator - cross field validation

2009-04-14 Thread AndyCramb

Hi,

I am trying the forms validation plugin and cannot figure out where I
am going wrong with it
I can get cross validation working aginst a checkbox but I am unable
to get it working against an input box
HTML is supplied below
The rules metadata is below the HTML
Any help is much appreciated
Andy

fieldset
legendTest JQuery validation/legend
ol
li
label for=cboxLast Months Bank Statement: /
label
input type=checkbox value=true name=cbox
id=cbox/input type=hidden value=false name=cbox/

/li
li
label for=sourceSource: /label
input type=text value= name=source
id=source/
/li
li
label for=dateDate: /label
input type=text value= name=date id=date/

/li
li
label for=amntPaidInAmount Paid In: /label
input type=text value= name=amntPaidIn
id=amntPaidIn/
/li
/ol
input type=submit value=validate/

/fieldset

rules: {
source: {
  required: #cbox:checked,//works
  minlength: 2
  }
  , date: {
  required: #source:filled,//not working
  minlength: 2
  }
  , amntPaidIn: {
  required: true,
  email: true
  }
}, debug: true


[jQuery] Re: Should $(document).ready() be external? And should it be placed at the bottom of the page?

2009-04-14 Thread roger

Andy is absolutely right, but I'd like to add that you can call $
(document).ready() anywhere on the page and as many times as you want.

On Apr 14, 10:34 am, Andy Matthews li...@commadelimited.com wrote:
 You can externalize the document.ready call if you choose, I do it all the
 time.

 As for putting it at the bottom of the page, I'd say no. Putting it in an
 external JS file, with the ready call makes it so that code is not run until
 the entire DOM is ready anyway.

 andy

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

 Behalf Of kgosser
 Sent: Tuesday, April 14, 2009 10:28 AM
 To: jQuery (English)
 Subject: [jQuery] Should $(document).ready() be external? And should it be
 placed at the bottom of the page?

 Hey all,

 Two quick questions for you. I couldn't find the answers while searching...
 This would be a great thing to add to the jQuery FAQ, by the way.

 (1) Is it advisable to place a page's $(document).ready() stuff in an
 external .js file?

 I've been doing a lot of reading and research on optimizing my front end
 code, and YSlow seems to make a big deal of placing code externally if
 possible for caching reasons. I understand the usefulness of placing the
 code in an external document for that reason, however, the problem is that
 there are a lot of functions for button and link clicks, shows/hides, etc.,
 that are unique to that page and used differently on other pages.

 Thus, putting it externally means it would most likely have to be in an
 independent file just for that page... which means an added HTTP request
 which is really the speed killer.

 So anyways, looking for thoughts on this one.

 (2) Is it advisable to place the $(document).ready() at the bottom of the
 page right before the closing BODY tag?

 Also when doing my research, I've seen that YSlow makes a big deal of this
 as well. I'm sure many of you on here have discussed it or thought about it
 yourself.

 My question though is does it make sense to put the ready() code at the
 bottom? Does it help? Is it useful? Will it break?

 Thanks in advance for any feedback. Take care everyone.


[jQuery] Re: jQuery.support -- No direct support for IE6 detection

2009-04-14 Thread publicJorn

Obviously I agree that IE6 should be banned. But since most big
corporations (and clients) still use it, I as a front-end developer
find that we need to keep supporting it.

But indeedly, conditional statements are once again the key.
Add this to the head of your page:
!--[if ie 6]
script
document.getElementsByTagName(html)[0].className += ( ie6);
/script
![endif]--

This adds the classname .ie6 to the html tag. Easy to check for this
in your scripts.
For some sites I use this to set the class .js aswell, so you can do
CSS tricks like .js .hide to hide elements if users have javascript.

Remember to put all the other JS just before the /body tag so it
won't interfere with the loading of the rest of your document.

.Jorn



On 8 apr, 01:19, tres treshug...@gmail.com wrote:
 I think that since user agent and version detection is merely
 deprecated at this point, it would be safe to use it to detectIE6
 given this circumstance, if you absolutely need to. There is no way to
 tell, but by the time it is pulled out of jQuery,IE6will be long
 gone (hopefully).

 That being said, conditional comments would probably be the best way
 for a png fix, especially since it doesn't get executed at all in
 other browsers.

 I think that all developers should get together and intentionally
 block out all versions of IE. If we all do it, we can stop M$!! BTW,
 anyone see:http://saveie6.com?

 --
 Fight the good fight,
 Trey

 On Apr 6, 11:18 am, RobG rg...@iinet.net.au wrote:

  On Apr 5, 2:43 am, Joe joseph.is...@gmail.com wrote:

   I'm all for migrating to thejQuery.support() utility method, but
   there is not definitive test available to detectIE6specifically.  Do
   we have a consensus on this yet?

  I think conditional comments are the best way to go, there are a
  number of solutions.  Don't try sniffing for IE using the UA string.

  URL:http://groups.google.com/group/comp.lang.javascript/browse_frm/thread...

  --
  Rob


[jQuery] How to make the superfish nav menu blend with the Pixture Reloaded menu?

2009-04-14 Thread ptc

Hi,

I want to make my superfish menu look just like the menu that exists
by default in the Pixture Reloaded theme in my drupal install. It's
black with a lighter upper half, which gives it a glassy look.

Will someone please direct me to the proper css files? If you could be
as detailed as possible, I'd appreciate it, as I'm pretty
inexperienced.

Thanks!



[jQuery] Re: Calling a function from a non-jQuery .JS file

2009-04-14 Thread dhtml



On Apr 14, 8:58 am, Klaus Hartl klaus.ha...@googlemail.com wrote:
 On 14 Apr., 15:41, MorningZ morni...@gmail.com wrote:

  So what is the error

 The error is obviously that toDate is not a jQuery method. Another

Right.

 problem is that that Dreamweaver method is using document.write which
 can cause a problem depending on where the function is being called
 and which is usually avoided in jQuery land.

Calling document.write in a jQuery ready callback won't work
consistently.


 Since toDate is not (yet) a jQuery method, let's make one:

 (function($) {

     var days = [
         'Sunday',
         'Monday',
         'Tuesday',
         'Wednesday',
         'Thursday',
         'Friday',
         'Saturday'
     ];

     var months = [
         'January',
         'February',
         'March',
         'April',
         'May',
         'June',
         'July',
         'August',
         'September',
         'October',
         'November',
         'December'
     ];

     $.fn.toDate = function() {
         var now = new Date;
         return this.html('pToday\'s Date:br /' + days[now.getDay
 ()] +
                         ', ' + now.getDate() + ' ' + months[now.getMonth()] + 
 ' ' +
                         now.getFullYear() + '/p');
     };

 })(jQuery);

 Now you can use it like:

 $(document).ready(function() {
    $('#today').toDate();

 });


Or not. The above is fine for some locales, but not all.

If you want to format a local date, what is wrong with just having:-

var todayEl = document.getElementById(today);
todayEl.innerHTML = formatDate(new Date); // [1]

?

[1]http://www.jibbering.com/faq/#formatDate

Garrett


[jQuery] Re: how to create multiple draggable div's with dynamic content

2009-04-14 Thread roger

Sounds like you need to create a function (or two) to manage the
creation of the draggable window and fill it with content. Your
function should either clone the markup from a hidden div on the page
or create new dom elements with javascript. You would then select the
container that you cloned or created, make it draggable and fill it
with content.

You could prepare some content from an ajax call and pass it into the
function below:

function makeDraggable(content) {
   $('body').append('div id=superDrag\
   a href=# onclick=$(\'#superDrag
\').remove()close/a\
   div id=superDragContent'+content+'/
div\
/div');
   $('#superDrag').draggable();
}

It would probably be more versatile to use it as a class:

function superDrag(content) {
   $('body').append('div id=superDrag\
   a id=superDragClose href=#
onclick=$(\'#superDrag\').remove()close/a\
   div id=superDragContent'+content+'/
div\
/div');
   $('#superDrag').draggable();

   this.draggable = $('#superDrag').get(0);
   this.draggableContent = $('#superDragContent').get(0);
   var thisSuperDrag = this;
   $('#superDragClose').click(function() {
  thisSuperDrag.close();
   });
}

superDrag.prototype.close = function() {
   $(this.draggable).remove();
}

var newSuperDrag = new superDrag();

There are many ways you could make this thing work. I found an
interesting javascript templating plugin called jBind that makes it
easy to pull markup from the dom and fill in variables. It's a lot
nicer than concatenating strings, but a lot slower.


On Apr 14, 4:43 am, hybris77 dist...@yahoo.com wrote:
 hi, I'm trying to acchieve something for a few days now and I need som
 guidence

 I need to be able to open a draggabel div, that's no worry using the
 jQuery UI plugin

 what im not getting my head around is how to create multiple instances
 of this window
 with dynamic content but with a templade html structure that is filled
 with data
 from a database

 i've tried to use clone() to have the template saved and hidden on
 the page but
 when using this everything fails to work at all

 did anyone acchieve this?

 I may be a little fuzzy about what my problem is, there's too much
 code to be
 posted here, what I need is a little support in my undertaking

 /pär


[jQuery] JQuery news fade and news scroller(please help me)

2009-04-14 Thread hamed7

hi friends
i want scroll or fade news in one line,please help me and send example,
(i am new in jquery).


[jQuery] [Superfish] How well does this work with RocketTheme?

2009-04-14 Thread Wade

Hi, I am using the RocketTheme template 'Synapse' on my site:
http://www.fitnoke.com; I am interested in upgrading my menu
capabilities for the top-nav menu on my site to Superfish, as it is
more Web 2.0.

What kind of actions are needed to make this work - preferably a step
by step way of getting it set up on there!

Thanks!


[jQuery] JQuery Superfish plugin currents-state problem (level 2 menu should not be sticky open after reload)

2009-04-14 Thread borkor

I'm using this plugin in the dynamic PHP enviroment, basic example.
http://users.tpg.com.au/j_birch/plugins/superfish/#sample1

After a successful page reload Second level LI remains OPEN as if I
am hovering over the first level menu.
What I want is to mark only first (horisontal) level of my navigation.
Second (vertical) menu should not be open when I first load this page.

Just to mention that I am setting current current state for each li
element in the tree. I tried all combinations, but just cant achieve
what I want.

Is this a problem or a bug? Any suggestions?


[jQuery] Creating custom attributes in html

2009-04-14 Thread seasoup

I was wondering what jquery developers opinion of adding custom
attributes to html tags is, and what your basis is for these
opinions?  Why is it a good idea, or why is it a bad idea?  What I
mean is this:

div href= myType=foocontent/div

where 'myType' isn't in any specifications.  I've run into developers
who think this is a good idea, and those who think this is a bad idea
and I'd like to get a better sense of both sides of the argument.
Personally, I use them all of the time.  They are a great way to
preserve information for use with .live() in jQuery, among other
things, and since I append a long string to the DOM instead of
creating lots of little DOM nodes, I generally cannot use .data() to
save information on the individual nodes.

Example of a usage:

div name=foo myType=barclick/div
...
$('div[name=foo]').live('click', function () {
   console.log($(this).attr('myType'));
});

Example of why I cannot use .data():

var htmlString = 'table';
for (var a = 0; a  100; a++) {
htmlString += 'trtd name=clickme nodeId=filter'+ a
+'click/td/tr';
}
htmlString += '/table';
$('div[name=foo]').append(htmlString);
$('td[name=clickme]').live('click', function() {
console.log($(this).attr('nodeId'));
});

To debate the merits of using this kind of append, please go to:
http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-correctly

What I'm looking for instead is a discussion of using custom
attributes in html.

Thanks,
Josh Powell


[jQuery] Re: Form validator - cross field validation

2009-04-14 Thread Jörn Zaefferer
There is no field with the id source? Add id=source to that input...

Jörn

On Tue, Apr 14, 2009 at 6:33 PM, AndyCramb andycr...@googlemail.com wrote:

 Hi,

 I am trying the forms validation plugin and cannot figure out where I
 am going wrong with it
 I can get cross validation working aginst a checkbox but I am unable
 to get it working against an input box
 HTML is supplied below
 The rules metadata is below the HTML
 Any help is much appreciated
 Andy

 fieldset
            legendTest JQuery validation/legend
            ol
                li
                    label for=cboxLast Months Bank Statement: /
 label
                    input type=checkbox value=true name=cbox
 id=cbox/input type=hidden value=false name=cbox/

                /li
                li
                    label for=sourceSource: /label
                    input type=text value= name=source
 id=source/
                /li
                li
                    label for=dateDate: /label
                    input type=text value= name=date id=date/

                /li
                li
                    label for=amntPaidInAmount Paid In: /label
                    input type=text value= name=amntPaidIn
 id=amntPaidIn/
                /li
            /ol
            input type=submit value=validate/

        /fieldset

    rules: {
        source: {
          required: #cbox:checked,//works
          minlength: 2
      }
      , date: {
          required: #source:filled,//not working
          minlength: 2
      }
      , amntPaidIn: {
          required: true,
          email: true
      }
    }, debug: true



[jQuery] script modules

2009-04-14 Thread Barquette

Hi all,

My code app runs like this:

//file app.js
var runapp = function () {

   // I have about 1800 code lines using jquery like this:
   var fn1 = function (data) {//...code...};
   var fn2 = function (data) {//...code...};
   var fn3 = function (data) {//...code...};

   fn1('blah');
};

//file index.html
script type=text/javascript
   $(document).ready(function(){
  runapp();
   });
/script

Now a days, this architecture works fine for me. But 1800 code lines
is a big problem

I think jQuery.extend is not a good solution, because I don't want
make a plug-in.

Can I have another solution?

thanks!!!


[jQuery] Is this a Safari/WebKit bug?

2009-04-14 Thread @oscargodson

I got this to work, so this isn't a issue anymore, but I'm curious if
this is a bug and I should report it, or if it's a bug everywhere
else :)

$('a').click(function(){
   //Following works in Firefox, but not in Safari 3-4
   //event.stopPropagation();
   //Works in both Safari as well as Firefox
   this.event.stopPropagation();
});

Is that how you were supposed to write it? In most tuts I have read
it's always just event.stopPropagation();


[jQuery] Re: Form validator - cross field validation

2009-04-14 Thread AndyCramb

Thanks for getting back to me
I have the id specified

input type=text value= name=source
id=source/

It just had wrapped on to the new line
Sorry I could not find away of formatting the code I pasted in so it
looks a bit of a mess

On Apr 14, 7:06 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 There is no field with the id source? Add id=source to that input...

 Jörn

 On Tue, Apr 14, 2009 at 6:33 PM, AndyCramb andycr...@googlemail.com wrote:

  Hi,

  I am trying the forms validation plugin and cannot figure out where I
  am going wrong with it
  I can get cross validation working aginst a checkbox but I am unable
  to get it working against an input box
  HTML is supplied below
  The rules metadata is below the HTML
  Any help is much appreciated
  Andy

  fieldset
             legendTest JQuery validation/legend
             ol
                 li
                     label for=cboxLast Months Bank Statement: /
  label
                     input type=checkbox value=true name=cbox
  id=cbox/input type=hidden value=false name=cbox/

                 /li
                 li
                     label for=sourceSource: /label
                     input type=text value= name=source
  id=source/
                 /li
                 li
                     label for=dateDate: /label
                     input type=text value= name=date id=date/

                 /li
                 li
                     label for=amntPaidInAmount Paid In: /label
                     input type=text value= name=amntPaidIn
  id=amntPaidIn/
                 /li
             /ol
             input type=submit value=validate/

         /fieldset

     rules: {
         source: {
           required: #cbox:checked,//works
           minlength: 2
       }
       , date: {
           required: #source:filled,//not working
           minlength: 2
       }
       , amntPaidIn: {
           required: true,
           email: true
       }
     }, debug: true


[jQuery] Re: Converting JSON to html output

2009-04-14 Thread Nando

I see I'm really still a complete klutz at javascript.

Thanks very much Stephan! I will give that a try.

On Apr 14, 5:56 pm, MorningZ morni...@gmail.com wrote:
 Well, just putting the JSON into a JSON viewer (this one is 
 excellent:http://www.codeplex.com/JsonViewer) you pasted into your last post

 you have no property of .ROWCOUNT, so that's a bad start..

 this is a quick mock up that works

 http://paste.pocoo.org/show/112508/

 (sorry about the if's... i never trust that the data is intact/
 complete)

 On Apr 14, 10:50 am, Nando d.na...@gmail.com wrote:

  Sure. Here's the JSON string being returned by the server. The only
  thing that will need some fiddling is that the year is being returned
  as a float. Not sure how to get that displayed as just an integer in
  JS.

  {COLUMNS:
  [REFERENCEID,AUTHOR,DETAIL,REFYEAR,REFTYPE],DATA:[[1,Chen
   Chen,Chinese Herbs and Recipes, Second Revision,2009.0,1],
  [16,Dana Cat,,,1],[5,Simon Becker,Chinese Medicine Today,
  2008.0,1],[14,tom cat,,2009.0,1],[4,Becker, Simon,Chinese
  Medicine Today,2009.0,2],[3,Dana,Dana's Secret Pasta Recipe,
  2008.0,5],[15,bob cat,,2007.0,5]]}

  On Apr 14, 4:32 pm, MorningZ morni...@gmail.com wrote:

   Can you give an example of the JSON to help?

   On Apr 14, 9:24 am, Nando d.na...@gmail.com wrote:

Hi,

I'm a jQuery and Javascript noob, and can't seem to get this to work.
The JSON output looks right to me via console.log(result), but the
select box isn't being populated. The select box needs to be populated
onfocus, because the interface is set up to allow the user to add new
options to the select via a popup without a page refresh.

$(function() {

  $.getJSON('index.cfm?view=listReferenceJSON',
    function(result,status) {
      console.log(result)
      var str = ''
      for(var i=0; i  result.ROWCOUNT; i++) {
        str+= 'option value='+result.DATA.REFERENCEID[i]
+''+result.DATA.AUTHOR[i]+' ('+result.DATA.REFYEAR[i]+')option'
      }
        $(refSelectBox).bind('focus', function(event, ui) {
          $(#refSelectBox).html(str)
        }
    });

});

select id=refSelectBox/select

Thanks in advance for any help.

Nando


[jQuery] assign event handler to multiple events

2009-04-14 Thread Tom Worster

i can assign a handler to one event type thus:

$('.things').focus(function(){
$(this).data('foo', true);
...
});

if i want to assign the same handler to several events, say focus, change,
and click, what's the tidy way to write it [assuming my handler wants to
access $(this)]?




[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery

2009-04-14 Thread Ricardo

Hi Lwangman,

Now that we know all your requirements, I rewrote it(again) to clean
it up :) Everything is commented so you know what's going on. Main
things changed is that you set the selector for the container, not the
the checkbox directly, so if the inputs are nested deeper inside
(inside a div in the TD i.e.) things will still work, and using a
class for the highlight (much cleaner, you set styles in the CSS like
it should be). Clearing the plugin or setting it again also resets the
highlights.

http://jsbin.com/opove

Less than 30 lines now, w/o comments.

cheers,
- ricardo

On Apr 14, 4:45 am, Lwangaman donjohn.f...@gmail.com wrote:
 Ok latest version I've included the possibility of adding a background
 color:http://jsbin.com/icena/edit

 The background color is specified as a second parameter in the
 function:
 $('table').dragCheck('td:not(.nono) :checkbox', 'pink')

 To clear the dragCheck:
 $('table').dragCheck('clear')

 On 13 Apr, 23:29, jscripter pc88m...@gmail.com wrote:

  Here's what I'm shooting for:

 http://jsbin.com/izoce/edit

  It's basically the same code as found on cross-browser.com, but I've
  added the cell highlighting.

  Works under Firefox, Opera and Chrome. It should also work under IE,
  but it doesn't seem to work when on the jsbin.com site. However, if
  you just download it and run it from a local file it should work for
  you.

  The text selection bug is basically fixed. It is still possible to
  select text if the mousedown event occurs in the right place between
  cells. I don't think text selection is possible if the border width is
  set to 0 (but then you also don't get a border.)

  On Apr 13, 2:30 pm, Lwangaman donjohn.f...@gmail.com wrote:

   I think I've done it.

  http://jsbin.com/adixe/edit

   I have also left out the mouseleave event, and applied the mouseup to
   the whole document instead of to the table, that way even if I leave
   the table but still have the mouse button down, I don't lose the value
   in the variable. Only if I let go of the mouse button (on or off the
   table) do I reset the variable.

   @Ricardo and @jscripter: does this work good?

   On 13 Apr, 14:41, Lwangaman donjohn.f...@gmail.com wrote:

I tried working on it again and made a little progress... Now I got
parent and child selected correctly, but I don't have mouseover
working for some reason...

   http://jsbin.com/avigi/edit

On 13 Apr, 02:43, Lwangaman donjohn.f...@gmail.com wrote:

 One more detail: mouseout should not take effect until mouseup.
 In fact, right now, if I click and begin to drag, then still holding
 the mouse button I leave the area, and still holding it come back over
 the cells, they no longer get checked / unchecked because mouseout has
 already kicked in. Instead it shouldn't kick in until I actually let
 go of the mouse button, and I could let go of it anywhere on the page
 I suppose, so I guess mouseup would have to be applied to the whole
 document.

 On 13 Apr, 02:33, Lwangaman donjohn.f...@gmail.com wrote:

  I tried something along those lines...

 http://jsbin.com/ehedu/edit

  But I just don't have the hang of using this correctly and knowing
  when to refer to dom elements as dom elements or as jquery 
  objects...

  The idea is to tie all events to the container of the checkboxes 
  (i.e.
  table cells), and not to the external container (table or ul list or
  whatever), and yet be able to read and write the value of the
  checkboxes...

  On 13 Apr, 01:13, Lwangaman donjohn.f...@gmail.com wrote:

   Taking up jscripter's suggestion, I just noticed myself that 
   applying
   the mousedown and mouseover to the whole table keeps you from 
   being
   able to click on any links that may be contained in the table. For
   example my table has links in the header cells that when clicked
   reorder the table according to that column. Now I can no longer 
   click
   them...
   And, as jscripter says, in the X-Library the mousedown and 
   mouseover
   was applied to the cells containing the checkboxes and not to the
   checkboxes themselves, so that it was enough to click on the cells
   surrounding the checkboxes in order to get them checked / 
   unchecked.

   Ricardo do you think you could manage something like that? (I'm 
   only
   an apprentice and I don't have your expertice!)

   On 12 Apr, 22:31, jscripter pc88m...@gmail.com wrote:

Hey - this is great work - I just happened to be looking for 
this
functionality.

How would you apply what you have done here to re-writing the 
original
X-library code that uses TDs for the checkbox label?

Thanks!

On Apr 12, 2:04 pm, Ricardo ricardob...@gmail.com wrote:

 Sure! I have a few other plugins I also want to upload, I'll 
 do that.

 

[jQuery] Re: Form validator - cross field validation

2009-04-14 Thread Jörn Zaefferer

Okay, then its something else. Could you provide a testpage?

Jörn

On Tue, Apr 14, 2009 at 10:08 PM, AndyCramb andycr...@googlemail.com wrote:

 Thanks for getting back to me
 I have the id specified

 input type=text value= name=source
 id=source/

 It just had wrapped on to the new line
 Sorry I could not find away of formatting the code I pasted in so it
 looks a bit of a mess

 On Apr 14, 7:06 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:
 There is no field with the id source? Add id=source to that input...

 Jörn

 On Tue, Apr 14, 2009 at 6:33 PM, AndyCramb andycr...@googlemail.com wrote:

  Hi,

  I am trying the forms validation plugin and cannot figure out where I
  am going wrong with it
  I can get cross validation working aginst a checkbox but I am unable
  to get it working against an input box
  HTML is supplied below
  The rules metadata is below the HTML
  Any help is much appreciated
  Andy

  fieldset
             legendTest JQuery validation/legend
             ol
                 li
                     label for=cboxLast Months Bank Statement: /
  label
                     input type=checkbox value=true name=cbox
  id=cbox/input type=hidden value=false name=cbox/

                 /li
                 li
                     label for=sourceSource: /label
                     input type=text value= name=source
  id=source/
                 /li
                 li
                     label for=dateDate: /label
                     input type=text value= name=date id=date/

                 /li
                 li
                     label for=amntPaidInAmount Paid In: /label
                     input type=text value= name=amntPaidIn
  id=amntPaidIn/
                 /li
             /ol
             input type=submit value=validate/

         /fieldset

     rules: {
         source: {
           required: #cbox:checked,//works
           minlength: 2
       }
       , date: {
           required: #source:filled,//not working
           minlength: 2
       }
       , amntPaidIn: {
           required: true,
           email: true
       }
     }, debug: true


[jQuery] override shortcut keys in safari 3+ with javascript

2009-04-14 Thread mmurph211

Hello,

I am trying to override Safari shortcut keys in javascript for use in
an online terminal window that requires key entries such as F5. As
this is a shortcut key to refresh the page in Safari this poses a
problem.

Does anyone know if you can override shortcut keys in Safari 3+ with
javascript? I have tried approaches such as return false,
stopPropagation(), preventDefault(), re-routing the keyCode/which
character, etc. Any help would be much appreciated.

Thanks
Matt


[jQuery] Re: Help- jquery Dynamic Image load - dbl click = loads twice

2009-04-14 Thread Diogo Shaw

$.fn.image = function(fn) {
var total = this.length, loaded = 0;
this.each(function() {
var i = new Image();
i.src = this.src;
$(i).load(function(){
loaded++;
if(loaded==total) fn();
});
});
}

// eg
$('img.slide').image(function() {
// success;
});


Diogo Shaw


[jQuery] Re: JQuery news fade and news scroller(please help me)

2009-04-14 Thread patrickberkeley

http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/scrollanimate.html

http://plugins.jquery.com/search/node/ticker+type%3Aproject_project

On Apr 14, 1:38 pm, hamed7 63hosse...@gmail.com wrote:
 hi friends
 i want scroll or fade news in one line,please help me and send example,
 (i am new in jquery).


[jQuery] Can you treat hover as a boolean?

2009-04-14 Thread paulhuband


Hi,

I am trying to build a dynamic nav menu. When you hover over a given image,
a fly-out menu appears to the right of the image.

I want the fly-out to disappear when the user hovers off the initial image,
but not if they hover over the fly-out menu.

Is there a way to detect if one or the other element is being hovered?

ie  if($(image).hover.is(true) || $(fly-out).hover.is(true)){do something}
(The above does not work)

I tried to set the hover on for the fly-out to show() the fly-out, but it
didn't override the hover out of the image which is calling the hide() for
the fly-out.

I am a bit of a n00b to jQuery and would aprieciate any help.

Cheers
-- 
View this message in context: 
http://www.nabble.com/Can-you-treat-hover-as-a-boolean--tp23046114s27240p23046114.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery

2009-04-14 Thread Lwangaman

@jscripter
Are you referring to my latest http://jsbin.com/isuga/edit ? Because
as far as text selection is concerned it's working fine for me on
Chrome, Firefox 3, and Internet Explorer 8.
Just out of curiosity, are you clicking and dragging on the first
column? Because the first column is outside of the range of the
dragcheck. It's only the cells with checkboxes that don't have text
selection. Same thing with the ul list, only the list items that have
a checkbox have text selection disabled.

Chrome 2.0 is a pre-beta release, so you can't really do testing on
that. I've got the latest stable release which is 1.0.154.55.

I also use Firefox 3.0.8, and it works fine. I suppose that the cursor
could be set also.

You are right that in Internet Explorer (I use version 8.0.6) the
highlight was not undoing on uncheck. It should work now, I also
included the cursor style which will also be unset with dragCheck
(clear):

http://jsbin.com/ujugi/edit


On 14 Apr, 17:42, jscripter pc88m...@gmail.com wrote:
 Hi,

 Here are my testing results:

 IE7: table cells highlight to yellow when checkboxes are checked, but
 don't go back to black when unchecked;
   same issue with ul list items (highlighting stuck on pink)

 Opera 9.64: same highlight problem that IE7 has

 Chrome 2.0.169.1: dragging in cells just selects text; checking/
 unchecking checkboxes doesn't change background in either the table or
 ul list. (I think some javascript is not getting run)

 Firefox 3.0.8: basically works as expected; only nit is that the
 cursor changes to a text insertion bar when over the labels. Perhaps
 this can be fixed with style=cursor: default ???

 (Note: IE7, Chrome and Firefox have the cursor changing to an
 insertion bar when over the checkbox label; only in Opera does the
 cursor stay as an arrow pointer.)

 Thanks again for your work on this.

 ER

 On Apr 14, 3:31 am, Lwangaman donjohn.f...@gmail.com wrote:

  Latest:http://jsbin.com/isuga/edit
  Simplified the code for the highlighting process and corrected the
  case-possibility that first parameter is left empty (in that case, all
  child checkboxes are involved).

  Empty parameter usage:
  $('table').dragCheck()
  for no parameters;
  $('table').dragCheck('', 'pink')
  for empty first parameter.
  Second parameter can be left out completely.

  On 14 Apr, 09:45, Lwangaman donjohn.f...@gmail.com wrote:

   Ok latest version I've included the possibility of adding a background
   color:http://jsbin.com/icena/edit

   The background color is specified as a second parameter in the
   function:
   $('table').dragCheck('td:not(.nono) :checkbox', 'pink')

   To clear the dragCheck:
   $('table').dragCheck('clear')

   On 13 Apr, 23:29, jscripter pc88m...@gmail.com wrote:

Here's what I'm shooting for:

   http://jsbin.com/izoce/edit

It's basically the same code as found on cross-browser.com, but I've
added the cell highlighting.

Works under Firefox, Opera and Chrome. It should also work under IE,
but it doesn't seem to work when on the jsbin.com site. However, if
you just download it and run it from a local file it should work for
you.

The text selection bug is basically fixed. It is still possible to
select text if the mousedown event occurs in the right place between
cells. I don't think text selection is possible if the border width is
set to 0 (but then you also don't get a border.)

On Apr 13, 2:30 pm, Lwangaman donjohn.f...@gmail.com wrote:

 I think I've done it.

http://jsbin.com/adixe/edit

 I have also left out the mouseleave event, and applied the mouseup to
 the whole document instead of to the table, that way even if I leave
 the table but still have the mouse button down, I don't lose the value
 in the variable. Only if I let go of the mouse button (on or off the
 table) do I reset the variable.

 @Ricardo and @jscripter: does this work good?

 On 13 Apr, 14:41, Lwangaman donjohn.f...@gmail.com wrote:

  I tried working on it again and made a little progress... Now I got
  parent and child selected correctly, but I don't have mouseover
  working for some reason...

 http://jsbin.com/avigi/edit

  On 13 Apr, 02:43, Lwangaman donjohn.f...@gmail.com wrote:

   One more detail: mouseout should not take effect until mouseup.
   In fact, right now, if I click and begin to drag, then still 
   holding
   the mouse button I leave the area, and still holding it come back 
   over
   the cells, they no longer get checked / unchecked because 
   mouseout has
   already kicked in. Instead it shouldn't kick in until I actually 
   let
   go of the mouse button, and I could let go of it anywhere on the 
   page
   I suppose, so I guess mouseup would have to be applied to the 
   whole
   document.

   On 13 Apr, 02:33, Lwangaman donjohn.f...@gmail.com wrote:

I tried something along those lines...

 

[jQuery] Re: Bug in my gallery, wtf?!

2009-04-14 Thread @oscargodson

That did the trick! Thanks a lot!

A note though is that in Safari, you should put this.event or else it
doesn't seem to fire.

I did not try it though with function(event), but I just did function
().

On Apr 14, 10:16 am, Rey Bango reyba...@gmail.com wrote:
 Without having access to the code it's hard to test it but it looks
 like an event bubbling issue in the click binding for '#carousel_nav
 a'. Could you try this:

 $('#carousel_nav a').click(function(event)
 {
 event.stopPropagation();
 c_slide($(this));

 });

 Rey...

 On Apr 13, 9:56 pm, @oscargodson oscargod...@gmail.com wrote:

  Before I post a link:

  A. Yes, the code is messy, I have been trying to fix this all day, and
  I have restructured my code at least a dozen times, and that is why it
  is so messy, so please don't say try cleaning it up :)

  B. There are 100s of images, I just haven't sliced them all out from
  the client's PDF yet, so only pneumatic and vintage load a set of
  images.

  C. Thumbs don't match with the large images yet, because I haven't sat
  down and matched the 100s of images yet, but it works correctly! :)

  OK so on with it:http://boozker.com/beall/

  Everything works perfectly ON LOAD! :(

  If you click on my custom carousal everything works. thumbs, left, and
  right arrows work fine.

  The 1 step arrows (ones on the black bar) work fine and even update
  the count correctly.

  However, ALL of this breaks when I reload with a click like this:
  $('#gallery_nav ul a').click(function(){
                  var new_set = $(this).attr('title').toLowerCase();
                  $.get(js/get_images.php, { set:new_set }, function(data){
                                  $('#carousel_wrapper 
  ul').empty().append(data);
                                  activate_gallery();
                  });
          });

  Here is my window load:
  $.get(js/get_images.php, { set:'history' }, function(data){
                                  $('#carousel_wrapper 
  ul').empty().append(data);
                                  activate_gallery();
                  });

  After you click on a new category, it basically run activate_gallery
  (); twice, and so when you click next on either arrows it jumps x2. If
  you change the category 3x it jumps 3x etc

  I KNOW it has to do with activate_gallery but I have NO CLUE how else
  to write it. :(

  Remember, I have move code chunks all over. Does anyone have any ideas
  on how to get this to work?


[jQuery] Return Dynamic Image using Ajax and PHP

2009-04-14 Thread Spencer

Hi,

I have a PHP script that is generating an image based on values passed
to the script using jQuery Ajax functionality. Here is the important
part of the PHP script;

header('Content-Type: image/jpeg');
imagejpeg($image, 'images/tmp/admin.preview.jpg');
imagedestroy($image);

I can get the image to display just fine without using Ajax. I would
prefer not to store the image locally on the server, but instead have
the preview image display temporarily in memory. I have the following
jQuery code implemented that sends the form data to the PHP script,
which generates the dynamic image for preview using jpeg image
stream.

$(document).ready(function()
{
var options = {
target: '#preview-wrapper',
type:   'post',
cache:  false,
url:'admin.preview.php', // return raw jpeg stream (see
above php code)
success:function(html) {
// attempted creating an image tag, then pointing to 
the php script
directly. Neither works properly.
}
};

// pass options to ajaxForm
$('#formAdmin').ajaxForm(options);

});


Hopefully someone can help answer the following questions;
1) What is the best way to accomplish this task? (i.e. return image
stream, return HTML image tag pointing to the locally stored jpeg,
etc...)
2) Could someone help me with the jQuery code?

Thanks in advance for any help or direction.



[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery

2009-04-14 Thread Lwangaman

Wow, you're good! I'm a self-taught, so I can see that you've got your
stuff, you make things clean and concise.

Only thing here is that the text selection is being canceled on all
the cells and not just the ones with checkboxes. What do you think is
better here? I think it's good to leave text selection on other cells
because they may contain values that the user can copy - paste if
necessary.
As for the css class, I was wondering in fact if it were possible to
define a class within the jquery code, but reading up on it it seems
that that is not possible, it wasn't designed for that. Which means
that the user has to define that class, so I suppose that would have
to be indicated together with the plugin.

Thanks for taking it into consideration again! I did upload a first
version of this plugin to the jquery plugins, now that it pretty much
works. I suppose we can add the new minor versions as the code is
perfected.

On 14 Apr, 22:42, Ricardo ricardob...@gmail.com wrote:
 Hi Lwangman,

 Now that we know all your requirements, I rewrote it(again) to clean
 it up :) Everything is commented so you know what's going on. Main
 things changed is that you set the selector for the container, not the
 the checkbox directly, so if the inputs are nested deeper inside
 (inside a div in the TD i.e.) things will still work, and using a
 class for the highlight (much cleaner, you set styles in the CSS like
 it should be). Clearing the plugin or setting it again also resets the
 highlights.

 http://jsbin.com/opove

 Less than 30 lines now, w/o comments.

 cheers,
 - ricardo

 On Apr 14, 4:45 am, Lwangaman donjohn.f...@gmail.com wrote:

  Ok latest version I've included the possibility of adding a background
  color:http://jsbin.com/icena/edit

  The background color is specified as a second parameter in the
  function:
  $('table').dragCheck('td:not(.nono) :checkbox', 'pink')

  To clear the dragCheck:
  $('table').dragCheck('clear')

  On 13 Apr, 23:29, jscripter pc88m...@gmail.com wrote:

   Here's what I'm shooting for:

  http://jsbin.com/izoce/edit

   It's basically the same code as found on cross-browser.com, but I've
   added the cell highlighting.

   Works under Firefox, Opera and Chrome. It should also work under IE,
   but it doesn't seem to work when on the jsbin.com site. However, if
   you just download it and run it from a local file it should work for
   you.

   The text selection bug is basically fixed. It is still possible to
   select text if the mousedown event occurs in the right place between
   cells. I don't think text selection is possible if the border width is
   set to 0 (but then you also don't get a border.)

   On Apr 13, 2:30 pm, Lwangaman donjohn.f...@gmail.com wrote:

I think I've done it.

   http://jsbin.com/adixe/edit

I have also left out the mouseleave event, and applied the mouseup to
the whole document instead of to the table, that way even if I leave
the table but still have the mouse button down, I don't lose the value
in the variable. Only if I let go of the mouse button (on or off the
table) do I reset the variable.

@Ricardo and @jscripter: does this work good?

On 13 Apr, 14:41, Lwangaman donjohn.f...@gmail.com wrote:

 I tried working on it again and made a little progress... Now I got
 parent and child selected correctly, but I don't have mouseover
 working for some reason...

http://jsbin.com/avigi/edit

 On 13 Apr, 02:43, Lwangaman donjohn.f...@gmail.com wrote:

  One more detail: mouseout should not take effect until mouseup.
  In fact, right now, if I click and begin to drag, then still holding
  the mouse button I leave the area, and still holding it come back 
  over
  the cells, they no longer get checked / unchecked because mouseout 
  has
  already kicked in. Instead it shouldn't kick in until I actually let
  go of the mouse button, and I could let go of it anywhere on the 
  page
  I suppose, so I guess mouseup would have to be applied to the 
  whole
  document.

  On 13 Apr, 02:33, Lwangaman donjohn.f...@gmail.com wrote:

   I tried something along those lines...

  http://jsbin.com/ehedu/edit

   But I just don't have the hang of using this correctly and 
   knowing
   when to refer to dom elements as dom elements or as jquery 
   objects...

   The idea is to tie all events to the container of the checkboxes 
   (i.e.
   table cells), and not to the external container (table or ul list 
   or
   whatever), and yet be able to read and write the value of the
   checkboxes...

   On 13 Apr, 01:13, Lwangaman donjohn.f...@gmail.com wrote:

Taking up jscripter's suggestion, I just noticed myself that 
applying
the mousedown and mouseover to the whole table keeps you from 
being
able to click on any links that may be contained in the table. 
For

[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery

2009-04-14 Thread Lwangaman

Then just wondering, I don't know all the specs... But why shouldn't
you use jquery's css method to set css? Will it be deprecated?

On 14 Apr, 22:42, Ricardo ricardob...@gmail.com wrote:
 Hi Lwangman,

 Now that we know all your requirements, I rewrote it(again) to clean
 it up :) Everything is commented so you know what's going on. Main
 things changed is that you set the selector for the container, not the
 the checkbox directly, so if the inputs are nested deeper inside
 (inside a div in the TD i.e.) things will still work, and using a
 class for the highlight (much cleaner, you set styles in the CSS like
 it should be). Clearing the plugin or setting it again also resets the
 highlights.

 http://jsbin.com/opove

 Less than 30 lines now, w/o comments.

 cheers,
 - ricardo

 On Apr 14, 4:45 am, Lwangaman donjohn.f...@gmail.com wrote:

  Ok latest version I've included the possibility of adding a background
  color:http://jsbin.com/icena/edit

  The background color is specified as a second parameter in the
  function:
  $('table').dragCheck('td:not(.nono) :checkbox', 'pink')

  To clear the dragCheck:
  $('table').dragCheck('clear')

  On 13 Apr, 23:29, jscripter pc88m...@gmail.com wrote:

   Here's what I'm shooting for:

  http://jsbin.com/izoce/edit

   It's basically the same code as found on cross-browser.com, but I've
   added the cell highlighting.

   Works under Firefox, Opera and Chrome. It should also work under IE,
   but it doesn't seem to work when on the jsbin.com site. However, if
   you just download it and run it from a local file it should work for
   you.

   The text selection bug is basically fixed. It is still possible to
   select text if the mousedown event occurs in the right place between
   cells. I don't think text selection is possible if the border width is
   set to 0 (but then you also don't get a border.)

   On Apr 13, 2:30 pm, Lwangaman donjohn.f...@gmail.com wrote:

I think I've done it.

   http://jsbin.com/adixe/edit

I have also left out the mouseleave event, and applied the mouseup to
the whole document instead of to the table, that way even if I leave
the table but still have the mouse button down, I don't lose the value
in the variable. Only if I let go of the mouse button (on or off the
table) do I reset the variable.

@Ricardo and @jscripter: does this work good?

On 13 Apr, 14:41, Lwangaman donjohn.f...@gmail.com wrote:

 I tried working on it again and made a little progress... Now I got
 parent and child selected correctly, but I don't have mouseover
 working for some reason...

http://jsbin.com/avigi/edit

 On 13 Apr, 02:43, Lwangaman donjohn.f...@gmail.com wrote:

  One more detail: mouseout should not take effect until mouseup.
  In fact, right now, if I click and begin to drag, then still holding
  the mouse button I leave the area, and still holding it come back 
  over
  the cells, they no longer get checked / unchecked because mouseout 
  has
  already kicked in. Instead it shouldn't kick in until I actually let
  go of the mouse button, and I could let go of it anywhere on the 
  page
  I suppose, so I guess mouseup would have to be applied to the 
  whole
  document.

  On 13 Apr, 02:33, Lwangaman donjohn.f...@gmail.com wrote:

   I tried something along those lines...

  http://jsbin.com/ehedu/edit

   But I just don't have the hang of using this correctly and 
   knowing
   when to refer to dom elements as dom elements or as jquery 
   objects...

   The idea is to tie all events to the container of the checkboxes 
   (i.e.
   table cells), and not to the external container (table or ul list 
   or
   whatever), and yet be able to read and write the value of the
   checkboxes...

   On 13 Apr, 01:13, Lwangaman donjohn.f...@gmail.com wrote:

Taking up jscripter's suggestion, I just noticed myself that 
applying
the mousedown and mouseover to the whole table keeps you from 
being
able to click on any links that may be contained in the table. 
For
example my table has links in the header cells that when clicked
reorder the table according to that column. Now I can no longer 
click
them...
And, as jscripter says, in the X-Library the mousedown and 
mouseover
was applied to the cells containing the checkboxes and not to 
the
checkboxes themselves, so that it was enough to click on the 
cells
surrounding the checkboxes in order to get them checked / 
unchecked.

Ricardo do you think you could manage something like that? (I'm 
only
an apprentice and I don't have your expertice!)

On 12 Apr, 22:31, jscripter pc88m...@gmail.com wrote:

 Hey - this is great work - I just happened to be looking for 
 this
   

[jQuery] min file for jQuery Validation Plugin

2009-04-14 Thread expresso

Ok, obviously we know what a min file is.   But can someone tell me
for the jQuery plugin what does this min file restrict you from or
strip out from the main?  What is filtered out?  I need to know what
I'm getting or not getting compared to the main jQuery Validation .js
library.

http://bassistance.de/jquery-plugins/jquery-plugin-validation/


[jQuery] Highlight table row

2009-04-14 Thread spstieng

I've tested different solutions found in here, and on the web, but I
can't get it working.
I simply want to highlight a table row.

I would like to you toggleClass
$(this).parents('tr').toggleClass(highlight);

This is my HTML code:
html
  head
  titleTitle/title
  link rel=stylesheet href=css/storeLocator.css type=text/css
media=screen charset=utf-8 /
  script type=text/javascript src=js/jquery.js charset=utf-8/
script
  /head
  body

table id=storeListTable
thead
  tr class=even
thID/th
thNavn/th
thE-post/th
thNettside/th
  /tr
/thead
tbody
tr class= id=store1
td10/td
tdBoss Store Oslo/td
td a href=mailto:;E-post/a/td
td a href=#www/a/td
  /tr
tr class= id=store3
td8/td
tdBrandstad Oslo City/td
td a href=mailto:a...@brandstad.no;E-post/a/td
td a href=#www/a/td
  /tr
tr class=even id=store4
td7/td
tdFashion Partner AS/td
td a href=mailto:b...@fashionpartners.com;E-post/a/td
td a href=#www/a/td
  /tr
tr class= id=store5
td1/td
tdFollestad/td
td a href=mailto:c...@online.no;E-post/a/td
td a href=#www/a/td
  /tr
tr class=even id=store6
td2/td
tdFollestad/td
td a href=mailto:d...@follestad.com;E-post/a/td
td a href=#www/a/td
  /tr
  /tbody
  /table
  /body
/html


My js file looks like this:
jQuery(document).ready(function() {

  jQuery(#storeListTable tr).mouseover(function () {
$(this).parents('#storeListTable tr').toggleClass(highlight);
alert('test');
  });
});


The ALERT is there to demonstrate that the function fiores on
mouseover.

Can anyone help me please? :)


[jQuery] Re: min file for jQuery Validation Plugin

2009-04-14 Thread expresso

minified files are just whitespace and line breaks removed, and object
names are shortened.  Nevermind.

On Apr 14, 4:49 pm, expresso dschin...@gmail.com wrote:
 Ok, obviously we know what a min file is.   But can someone tell me
 for the jQuery plugin what does this min file restrict you from or
 strip out from the main?  What is filtered out?  I need to know what
 I'm getting or not getting compared to the main jQuery Validation .js
 library.

 http://bassistance.de/jquery-plugins/jquery-plugin-validation/


[jQuery] Re: how to create multiple draggable div's with dynamic content

2009-04-14 Thread hybris77

thanks a bunch for your reply, and a thorough one as well

I've experimented with a similar technique that you suggest
where I had a template of xhtml and I thought I'll clone this and
add the content, sounds like an excellent plan to me, right?

one thing I kept running into was the the page going blank
when appending elements on the body, any ideas on this
one?

but thanks, I'll go for one of the techniques described and
we'lll se how it ends up, I've got the whole script ready, just
need to get it to be able to open more than one instance

/pär



On 14 Apr, 17:49, roger rgrw...@gmail.com wrote:
 Sounds like you need to create a function (or two) to manage the
 creation of the draggable window and fill it with content. Your
 function should either clone the markup from a hidden div on the page
 or create new dom elements with javascript. You would then select the
 container that you cloned or created, make it draggable and fill it
 with content.

 You could prepare some content from an ajax call and pass it into the
 function below:

 function makeDraggable(content) {
    $('body').append('div id=superDrag\
                                a href=# onclick=$(\'#superDrag
 \').remove()close/a\
                                div id=superDragContent'+content+'/
 div\
                             /div');
    $('#superDrag').draggable();

 }

 It would probably be more versatile to use it as a class:

 function superDrag(content) {
    $('body').append('div id=superDrag\
                                a id=superDragClose href=#
 onclick=$(\'#superDrag\').remove()close/a\
                                div id=superDragContent'+content+'/
 div\
                             /div');
    $('#superDrag').draggable();

    this.draggable = $('#superDrag').get(0);
    this.draggableContent = $('#superDragContent').get(0);
    var thisSuperDrag = this;
    $('#superDragClose').click(function() {
       thisSuperDrag.close();
    });

 }

 superDrag.prototype.close = function() {
    $(this.draggable).remove();

 }

 var newSuperDrag = new superDrag();

 There are many ways you could make this thing work. I found an
 interesting javascript templating plugin called jBind that makes it
 easy to pull markup from the dom and fill in variables. It's a lot
 nicer than concatenating strings, but a lot slower.

 On Apr 14, 4:43 am, hybris77 dist...@yahoo.com wrote:

  hi, I'm trying to acchieve something for a few days now and I need som
  guidence

  I need to be able to open a draggabel div, that's no worry using the
  jQuery UI plugin

  what im not getting my head around is how to create multiple instances
  of this window
  with dynamic content but with a templade html structure that is filled
  with data
  from a database

  i've tried to use clone() to have the template saved and hidden on
  the page but
  when using this everything fails to work at all

  did anyone acchieve this?

  I may be a little fuzzy about what my problem is, there's too much
  code to be
  posted here, what I need is a little support in my undertaking

  /pär


[jQuery] Re: Highlight table row

2009-04-14 Thread James

This does a highlight on mouseover and remove highlight on mouseout.
Is this what you want?

// untested
$(#storeListTable tbody tr).hover(
 function() {  // mouseover
  $(this).addClass('highlight');
 },
 function() {  // mouseout
  $(this).removeClass('highlight');
 }
);


On Apr 14, 11:51 am, spstieng spsti...@hotmail.com wrote:
 I've tested different solutions found in here, and on the web, but I
 can't get it working.
 I simply want to highlight a table row.

 I would like to you toggleClass
 $(this).parents('tr').toggleClass(highlight);

 This is my HTML code:
 html
   head
   titleTitle/title
   link rel=stylesheet href=css/storeLocator.css type=text/css
 media=screen charset=utf-8 /
   script type=text/javascript src=js/jquery.js charset=utf-8/
 script
   /head
   body

 table id=storeListTable
     thead
       tr class=even
         thID/th
         thNavn/th
         thE-post/th
         thNettside/th
       /tr
     /thead
     tbody
             tr class= id=store1
         td10/td
         tdBoss Store Oslo/td
         td a href=mailto:;E-post/a/td
         td a href=#www/a/td
       /tr
             tr class= id=store3
         td8/td
         tdBrandstad Oslo City/td
         td a href=mailto:a...@brandstad.no;E-post/a/td
         td a href=#www/a/td
       /tr
             tr class=even id=store4
         td7/td
         tdFashion Partner AS/td
         td a href=mailto:b...@fashionpartners.com;E-post/a/td
         td a href=#www/a/td
       /tr
             tr class= id=store5
         td1/td
         tdFollestad/td
         td a href=mailto:c...@online.no;E-post/a/td
         td a href=#www/a/td
       /tr
             tr class=even id=store6
         td2/td
         tdFollestad/td
         td a href=mailto:d...@follestad.com;E-post/a/td
         td a href=#www/a/td
       /tr
           /tbody
   /table
   /body
 /html

 My js file looks like this:
 jQuery(document).ready(function() {

   jQuery(#storeListTable tr).mouseover(function () {
     $(this).parents('#storeListTable tr').toggleClass(highlight);
     alert('test');
   });

 });

 The ALERT is there to demonstrate that the function fiores on
 mouseover.

 Can anyone help me please? :)


[jQuery] Re: assign event handler to multiple events

2009-04-14 Thread James

$('.things').bind('focus change click', function() {
 // your code here
});

(Note that this doesn't work for $.live(), as you can only bind one
event for that.)

On Apr 14, 10:40 am, Tom Worster f...@thefsb.org wrote:
 i can assign a handler to one event type thus:

 $('.things').focus(function(){
     $(this).data('foo', true);
     ...

 });

 if i want to assign the same handler to several events, say focus, change,
 and click, what's the tidy way to write it [assuming my handler wants to
 access $(this)]?


[jQuery] Re: Is this a Safari/WebKit bug?

2009-04-14 Thread Ricardo

You need to pass the event object as parameter, if you don't you're
accessing the global window.event object which differs across
browsers:

$('a').click(function(e){
   e.stopPropagation();
});

On Apr 14, 3:41 pm, @oscargodson oscargod...@gmail.com wrote:
 I got this to work, so this isn't a issue anymore, but I'm curious if
 this is a bug and I should report it, or if it's a bug everywhere
 else :)

 $('a').click(function(){
    //Following works in Firefox, but not in Safari 3-4
    //event.stopPropagation();
    //Works in both Safari as well as Firefox
    this.event.stopPropagation();

 });

 Is that how you were supposed to write it? In most tuts I have read
 it's always just event.stopPropagation();


[jQuery] Re: Creating custom attributes in html

2009-04-14 Thread Ricardo

If you insert these attributes server-side, the page will not validate
and might trigger quirks mode in the browser. If you are adding them
after load, there's no harm in it, but I bet using data() would be
faster for lots of elements.

On Apr 14, 2:56 pm, seasoup seas...@gmail.com wrote:
 I was wondering what jquery developers opinion of adding custom
 attributes to html tags is, and what your basis is for these
 opinions?  Why is it a good idea, or why is it a bad idea?  What I
 mean is this:

 div href= myType=foocontent/div

 where 'myType' isn't in any specifications.  I've run into developers
 who think this is a good idea, and those who think this is a bad idea
 and I'd like to get a better sense of both sides of the argument.
 Personally, I use them all of the time.  They are a great way to
 preserve information for use with .live() in jQuery, among other
 things, and since I append a long string to the DOM instead of
 creating lots of little DOM nodes, I generally cannot use .data() to
 save information on the individual nodes.

 Example of a usage:

 div name=foo myType=barclick/div
 ...
 $('div[name=foo]').live('click', function () {
    console.log($(this).attr('myType'));

 });

 Example of why I cannot use .data():

 var htmlString = 'table';
 for (var a = 0; a  100; a++) {
     htmlString += 'trtd name=clickme nodeId=filter'+ a
 +'click/td/tr';}

 htmlString += '/table';
 $('div[name=foo]').append(htmlString);
 $('td[name=clickme]').live('click', function() {
     console.log($(this).attr('nodeId'));

 });

 To debate the merits of using this kind of append, please go 
 to:http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-cor...

 What I'm looking for instead is a discussion of using custom
 attributes in html.

 Thanks,
 Josh Powell


[jQuery] Re: Creating custom attributes in html

2009-04-14 Thread Josh Powell

I cannot use .data() as I do not have a node.  Creating a node for
every td creates impossibly excessive append time.  One one page I
shortened the time to append for 500 table rows from 29,000ms to
900ms.  Good to know about the potential for triggering quirks mode
though, thanks.

Josh Powell

On Apr 14, 3:34 pm, Ricardo ricardob...@gmail.com wrote:
 If you insert these attributes server-side, the page will not validate
 and might trigger quirks mode in the browser. If you are adding them
 after load, there's no harm in it, but I bet using data() would be
 faster for lots of elements.

 On Apr 14, 2:56 pm, seasoup seas...@gmail.com wrote:

  I was wondering what jquery developers opinion of adding custom
  attributes to html tags is, and what your basis is for these
  opinions?  Why is it a good idea, or why is it a bad idea?  What I
  mean is this:

  div href= myType=foocontent/div

  where 'myType' isn't in any specifications.  I've run into developers
  who think this is a good idea, and those who think this is a bad idea
  and I'd like to get a better sense of both sides of the argument.
  Personally, I use them all of the time.  They are a great way to
  preserve information for use with .live() in jQuery, among other
  things, and since I append a long string to the DOM instead of
  creating lots of little DOM nodes, I generally cannot use .data() to
  save information on the individual nodes.

  Example of a usage:

  div name=foo myType=barclick/div
  ...
  $('div[name=foo]').live('click', function () {
     console.log($(this).attr('myType'));

  });

  Example of why I cannot use .data():

  var htmlString = 'table';
  for (var a = 0; a  100; a++) {
      htmlString += 'trtd name=clickme nodeId=filter'+ a
  +'click/td/tr';}

  htmlString += '/table';
  $('div[name=foo]').append(htmlString);
  $('td[name=clickme]').live('click', function() {
      console.log($(this).attr('nodeId'));

  });

  To debate the merits of using this kind of append, please go 
  to:http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-cor...

  What I'm looking for instead is a discussion of using custom
  attributes in html.

  Thanks,
  Josh Powell


[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery

2009-04-14 Thread Ricardo


On Apr 14, 6:38 pm, Lwangaman donjohn.f...@gmail.com wrote:
 Only thing here is that the text selection is being canceled on all
 the cells and not just the ones with checkboxes. What do you think is
 better here? I think it's good to leave text selection on other cells
 because they may contain values that the user can copy - paste if
 necessary.

Added a .filter(':has(:checkbox)'), so everything is only applied to
elements which contain a checkbox. Whew! this has gotta be the most
rewritten jsbin code snippet ever :D

so I suppose that would have to be indicated together with the plugin.

You're right, that's very common in plugins which deal with an UI.

Then just wondering, I don't know all the specs... But why shouldn't
you use jquery's css method to set css? Will it be deprecated?

No, they won't. It's just a cleaner approach. By leaving style
definitions where they belong (CSS) one can change colors and layout
in the page without having to touch the JS code, even for the
widgets used.

cheers,
- ricardo


[jQuery] Re: Creating custom attributes in html

2009-04-14 Thread James

You might want to check out the Metadata plugin:
http://plugins.jquery.com/project/metadata
It'll let you get data in the CLASS (and other custom) attribute so
your HTML can technically remain valid (I think).

Personally, I try to keep my code as valid as possible to hopefully
avoid quirks mode and the unpredictable results it may cause. I
usually store additional data as a part of the element's ID or CLASS,
like id=myID_12345 and use Javascript to parse the value. If there's
more data than that, I'd prefer to have them stored separately, such
as in a Javascript array or JSON object and use the unique ID stored
with the element to reference it when needed.

On Apr 14, 7:56 am, seasoup seas...@gmail.com wrote:
 I was wondering what jquery developers opinion of adding custom
 attributes to html tags is, and what your basis is for these
 opinions?  Why is it a good idea, or why is it a bad idea?  What I
 mean is this:

 div href= myType=foocontent/div

 where 'myType' isn't in any specifications.  I've run into developers
 who think this is a good idea, and those who think this is a bad idea
 and I'd like to get a better sense of both sides of the argument.
 Personally, I use them all of the time.  They are a great way to
 preserve information for use with .live() in jQuery, among other
 things, and since I append a long string to the DOM instead of
 creating lots of little DOM nodes, I generally cannot use .data() to
 save information on the individual nodes.

 Example of a usage:

 div name=foo myType=barclick/div
 ...
 $('div[name=foo]').live('click', function () {
    console.log($(this).attr('myType'));

 });

 Example of why I cannot use .data():

 var htmlString = 'table';
 for (var a = 0; a  100; a++) {
     htmlString += 'trtd name=clickme nodeId=filter'+ a
 +'click/td/tr';}

 htmlString += '/table';
 $('div[name=foo]').append(htmlString);
 $('td[name=clickme]').live('click', function() {
     console.log($(this).attr('nodeId'));

 });

 To debate the merits of using this kind of append, please go 
 to:http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-cor...

 What I'm looking for instead is a discussion of using custom
 attributes in html.

 Thanks,
 Josh Powell


[jQuery] Re: Creating custom attributes in html

2009-04-14 Thread RobG



On Apr 15, 8:41 am, Josh Powell seas...@gmail.com wrote:

 Good to know about the potential for triggering quirks mode
 though, thanks.

You are already using invalid markup by adding a name attribute to a
div element.

Have you considered storing the data in the class attribute, then use
DOM dot property access with a RegExp to get the value?  It should be
much faster than using attr.

--
Rob


[jQuery] Re: Error with BlockUI: 'parentNode' is null or not an object

2009-04-14 Thread Mike Alsup

 Thanks for the replies. I found out that the problem has to do with
 the fact that The BlockUi plug-in actually removes the passed in node
 from the DOM. At least I know what's going on now and am able to
 figure out a workaround. That's not good behavior for a plug-in.


What version of the plugin are you using?  I have a demo which does
this same thing, uses an element for the blocking message, and it's
working just fine over and over:  http://localhost:/malsup/block/#page

BlockUI moves the element and then returns it to it's original
location after unblocking.  It does not remove it from the DOM
(although it used to at one time).

Mike


[jQuery] Re: Error with BlockUI: 'parentNode' is null or not an object

2009-04-14 Thread Jonathan

http://www.malsup.com/jquery/block/#page

On Apr 14, 4:26 pm, Mike Alsup mal...@gmail.com wrote:
  Thanks for the replies. I found out that the problem has to do with
  the fact that The BlockUi plug-in actually removes the passed in node
  from the DOM. At least I know what's going on now and am able to
  figure out a workaround. That's not good behavior for a plug-in.

 What version of the plugin are you using?  I have a demo which does
 this same thing, uses an element for the blocking message, and it's
 working just fine over and over:  http://localhost:/malsup/block/#page

 BlockUI moves the element and then returns it to it's original
 location after unblocking.  It does not remove it from the DOM
 (although it used to at one time).

 Mike


[jQuery] question about each function

2009-04-14 Thread jack

Hi, all

See the following.

$(input:text).each(function(){
   
   if(something happened) return;
   ---
   ---
})

I found the 'return' only exit form a particular input element. And it
won't return from each function. It always go through every
element. I mean if something happened I don't want to go any further
elements and just exit from each function. Is there any way to do
that? Thank you in advance!


[jQuery] Re: question about each function

2009-04-14 Thread Leeoniya

i, too, am curious how to break out of a .each() loop.

On Apr 14, 7:35 pm, jack datac...@gmail.com wrote:
 Hi, all

 See the following.

 $(input:text).each(function(){
    
    if(something happened) return;
    ---
    ---

 })

 I found the 'return' only exit form a particular input element. And it
 won't return from each function. It always go through every
 element. I mean if something happened I don't want to go any further
 elements and just exit from each function. Is there any way to do
 that? Thank you in advance!


[jQuery] Re: question about each function

2009-04-14 Thread Leeoniya

well according to
http://docs.jquery.com/Core/each
returning false SHOULD break out of the loop, haven't tried it tho - i
can't imagine something like this would be broken at this point, maybe
your condition is never being met?

On Apr 14, 7:51 pm, Leeoniya leeon...@gmail.com wrote:
 i, too, am curious how to break out of a .each() loop.

 On Apr 14, 7:35 pm, jack datac...@gmail.com wrote:

  Hi, all

  See the following.

  $(input:text).each(function(){
     
     if(something happened) return;
     ---
     ---

  })

  I found the 'return' only exit form a particular input element. And it
  won't return from each function. It always go through every
  element. I mean if something happened I don't want to go any further
  elements and just exit from each function. Is there any way to do
  that? Thank you in advance!


[jQuery] Re: assign event handler to multiple events

2009-04-14 Thread Leeoniya

if you still need the performance of event delegation (live), you
should make the handling function separately and assign it using
several lives. eg:

function handleStuff(e) {
  // do things
}

$(div  p, #nav a).live(click, handleStuff).live(keydown,
handleStuff);

be aware that live() doesnt officially support a lot of events
(blur, focus, mouseenter, mouseleave, change, submit)...though they
will work in some browsers (tested in Minefield nightlies)...so you'll
still need bind() for those until they work out all the cross-browser
issues for them.

On Apr 14, 5:21 pm, James james.gp@gmail.com wrote:
 $('.things').bind('focus change click', function() {
      // your code here

 });

 (Note that this doesn't work for $.live(), as you can only bind one
 event for that.)

 On Apr 14, 10:40 am, Tom Worster f...@thefsb.org wrote:

  i can assign a handler to one event type thus:

  $('.things').focus(function(){
      $(this).data('foo', true);
      ...

  });

  if i want to assign the same handler to several events, say focus, change,
  and click, what's the tidy way to write it [assuming my handler wants to
  access $(this)]?


[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery

2009-04-14 Thread Lwangaman

Ok so what's the link to the latest version? (It's a good thing that
jsbin deletes files after 3 months of no usage! I was thinking the
same myself!)

On 15 Apr, 00:45, Ricardo ricardob...@gmail.com wrote:
 On Apr 14, 6:38 pm, Lwangaman donjohn.f...@gmail.com wrote:

  Only thing here is that the text selection is being canceled on all
  the cells and not just the ones with checkboxes. What do you think is
  better here? I think it's good to leave text selection on other cells
  because they may contain values that the user can copy - paste if
  necessary.

 Added a .filter(':has(:checkbox)'), so everything is only applied to
 elements which contain a checkbox. Whew! this has gotta be the most
 rewritten jsbin code snippet ever :D

 so I suppose that would have to be indicated together with the plugin.

 You're right, that's very common in plugins which deal with an UI.

 Then just wondering, I don't know all the specs... But why shouldn't
 you use jquery's css method to set css? Will it be deprecated?

 No, they won't. It's just a cleaner approach. By leaving style
 definitions where they belong (CSS) one can change colors and layout
 in the page without having to touch the JS code, even for the
 widgets used.

 cheers,
 - ricardo


[jQuery] Re: Slideshow with Carousel and spotlight?

2009-04-14 Thread rubycat

For what it's worth, here's my plea for pretty much the same
thing...the magic of Cycle combined with the utility of jCarousel.
Have been agonizing over this, searching endlessly for an unobtrusive
solution with no luck.


[jQuery] Re: question about each function

2009-04-14 Thread Leeoniya

wait, you should be doing return FALSE rather than just return

On Apr 14, 7:57 pm, Leeoniya leeon...@gmail.com wrote:
 well according tohttp://docs.jquery.com/Core/each
 returning false SHOULD break out of the loop, haven't tried it tho - i
 can't imagine something like this would be broken at this point, maybe
 your condition is never being met?

 On Apr 14, 7:51 pm, Leeoniya leeon...@gmail.com wrote:

  i, too, am curious how to break out of a .each() loop.

  On Apr 14, 7:35 pm, jack datac...@gmail.com wrote:

   Hi, all

   See the following.

   $(input:text).each(function(){
      
      if(something happened) return;
      ---
      ---

   })

   I found the 'return' only exit form a particular input element. And it
   won't return from each function. It always go through every
   element. I mean if something happened I don't want to go any further
   elements and just exit from each function. Is there any way to do
   that? Thank you in advance!


[jQuery] Re: question about each function

2009-04-14 Thread MorningZ

As Leeoniya notes:

$(input:text).each(function(){
   if(something happened) { return false; }
})


On Apr 14, 8:59 pm, Leeoniya leeon...@gmail.com wrote:
 wait, you should be doing return FALSE rather than just return

 On Apr 14, 7:57 pm, Leeoniya leeon...@gmail.com wrote:

  well according tohttp://docs.jquery.com/Core/each
  returning false SHOULD break out of the loop, haven't tried it tho - i
  can't imagine something like this would be broken at this point, maybe
  your condition is never being met?

  On Apr 14, 7:51 pm, Leeoniya leeon...@gmail.com wrote:

   i, too, am curious how to break out of a .each() loop.

   On Apr 14, 7:35 pm, jack datac...@gmail.com wrote:

Hi, all

See the following.

$(input:text).each(function(){
   
   if(something happened) return;
   ---
   ---

})

I found the 'return' only exit form a particular input element. And it
won't return from each function. It always go through every
element. I mean if something happened I don't want to go any further
elements and just exit from each function. Is there any way to do
that? Thank you in advance!


[jQuery] Re: XSLT with anchors

2009-04-14 Thread Jonathan Maddison

Thanks Benjamin. Thanks to you I have finally found the problem.

After I uploaded an example to post I tried it on a different computer/
browser and I could not replicate the issue.

Apparently it is a bug in my (old) version of Firefox.

https://bugzilla.mozilla.org/show_bug.cgi?id=212362


[jQuery] Problem to get Text displayed in jquery function

2009-04-14 Thread globalpropertyonline....@gmail.com

Hi All,

I have a function with jcarousel but for some reason, I just can not
get the text to show below my images in the Container.

One guy helped me with various options but as you can see below, I am
still stuck.

Any help ?

I have now added the function as follows in the head and tried the
following two lines at three different places but still no luck. The
errors seems to have gone away now , but I do not see the Bla.


div = $(div style='display:none'blah/div);
$(document.body).appendChild(div);


1) I have put the two lines in the function but no luck,
2) I have put the two lines in the fuction below the Return HTML Get
Element but no luck.
3) I have put it in its own javascript tags below the declaration of
the div as it is but no luck.


This is the function now in the head. You can see my code source
here.
http://www.somewhere2rent.com/test/


I have also made the image smaller just in case the text is behind
the
image.


script type=text/javascript


$(function()
{
whatever(); {


jcarousel.find(img)
.hover(
function(){
div.css({display:'block',position:'absolute',left:$(this).offset
().left, top:$(this).offset().top+$(this).height()});



},


function(){
div.css({display:'none'});


});
},
});


/script

body


div id=wrap align=center


script type=text/javascript


div = $(div style='display:none'blah/div);
$(document.body).appendChild(div);


/script


  ul id=mycarousel class=jcarousel-skin-ie7
!-- The content will be dynamically loaded in here --
  /ul


/div


/body
/html


ANy more help will be apreciated.


Thanks


[jQuery] question about dealing with JSON callback

2009-04-14 Thread sneaks

hi! i am trying to use jQuery.post() to send name/value to a php
function which then retreives data from mysql and responds with JSON
which looks like this when i append it directly to my debug output
div:

{product_id:02,product_name:Cesario
Lo,product_brand:Creative
rec,product_slug:slug2,product_description:description2,product_active:1,product_type:shoe,product_gender:female,product_sizes:8.5,product_style:style
2,product_categories:2,product_shipping:shipping
2,product_cost:30.0,product_retail:60.0}

i have tried to iterate through the JSON using the jQuery.each():

Query.each(obj, function(i, val) {
etc...

but it is iterating character by character rather than by each pair

best,
jonathan





[jQuery] Re: Slideshow with Carousel and spotlight?

2009-04-14 Thread Jack Killpatrick


Hmm, I have a pretty big collection of plugin bookmarks, but looked 
through them and couldn't find something that seemed quite right, 
either. Found this, which seems like a near-hit:


http://www.monc.se/galleria/demo/demo_01.htm#img/lightning.jpg

and this, but it hooks to Flickr:

http://www.userfriendlythinking.com/Blog/BlogDetail.asp?p1=7013p2=101p7=3001

I'm interested in hearing if you find something. Good luck!

- Jack

rubycat wrote:

For what it's worth, here's my plea for pretty much the same
thing...the magic of Cycle combined with the utility of jCarousel.
Have been agonizing over this, searching endlessly for an unobtrusive
solution with no luck.

  





[jQuery] Re: trouble stopping propagation

2009-04-14 Thread gmoniey

I'm still stuck on this...does anyone have any ideas?

On Apr 13, 10:35 am, gmoniey gmon...@gmail.com wrote:
 Hi,

 I have a simple onclick function call for a div which looks like this:
 onclick=showPanel(this).
 And the showPanel function header is as such:

 function showPanel(el) {

 }

 I also have some children in the div which are links, and I want top stop
 the propagation. Unfortunately, when I put a breakpoint inside showPanel
 (using FF3), 'el' does not have any of the following properties: srcElement,
 target, stopPropagation. So I can't seem figure out if I should return of
 continue the function.

 I even tried to wrap the inner links inside a div which had a similar
 onclick function whose purpose is only to call stopPropagation, but I got
 the same results as above (i.e. no stopPropagation method).

 I thought about establishing the onclick function as such:

         $('div').filter('.myPanel').click(function (event) {    });

 and checking the event target inside the function, but I load parts of the
 html through ajax, which means I will after run the code above after load,
 and that solution just doesnt seem that clean.

 Anyone have any ideas on how I can manage this?

 Thanks.
 --
 View this message in 
 context:http://www.nabble.com/trouble-stopping-propagation-tp23025769s27240p2...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Nyromodal frame reference

2009-04-14 Thread Alan Flisch

Hi,

I'm using Nyromodal to show some web content that includes page 
transitions controlled by Javascript that specifies window.location. The 
trouble with this is that it navigates the main browser window rather 
than navigating just within the nyromodal frame.

I'm not sure how to get round this, especially as the Nyromodal frame 
seems to have no name, and I'd really appreciate some help.

Thanks!


[jQuery] Animation Issue

2009-04-14 Thread Connor

Hi,

I've had this issue when animating before, but have always found a
hack around it. But for this project I can't think of any work around.
What happens is some elements inside the animated element and near the
animated element disappear during animation. To view it in action go
to http://www.cyberantix.org/demo/portfolio/projects.html

Click on any of the projects to expand them. See how parts disappear?
Does anyone know how to fix this?

One other note: I haven't debugged this for Internet Explorer yet, so
if you would, try it in any other browser.

Thanks,


Connor

Let me know if you would prefer me to paste the code here instead of
looking at the source code.


[jQuery] IE problem with each function

2009-04-14 Thread Zhx

here is my code, it works fine in FF, but in IE, the index message
did not popup. Anyone could give me a suggestion to figure out this?
   jQuery(#demoform dt).each(function(index,domEle){
if (jQuery(domEle).text() == ISSN:)
 {
 alert(index);
 exit;
 }
})


  1   2   >