[jQuery] How to create an "Add New Option" option to a select list

2009-10-12 Thread Charles

Hello all,

I have a form that uses jeditable to edit-in-place several fields and
select boxes. Everything is working great. Now I need to a way to add
a new option to the select list.

What I would like is the user select "Add New..." from the select list
that would pop-up a dialog window where several fields are filled in.
When the form is saved the select field is updated with the new ID and
description.

I use Facebox for pop-up windows to display notes when the user clicks
on a topic. I know Facebox can be used to display a form. It would be
ideal to use this ability when creating a new option for the select
box.

Does anyone know of a tutorial or can guide me in creating this?

Thanks,
Charles


[jQuery] Re: Jeditable - How to style a button using CSS

2009-05-29 Thread Charles

AHA - I was missing the "cssclass : 'editable'" part! Thanks Mika!!

I am a total newbie to jquery -- you have helped me greatly. This plug-
in is awesome!

Thanks,
Charles


On May 29, 7:02 am, Mika Tuupola  wrote:
> On May 29, 2009, at 6:40 AM, Charles wrote:
>
>
>
> > Hello all,
>
> > I am a newbie to jquery and jeditable. I have a select that is working
> > using jeditable. However, I cannot figure out how to style the submit
> > button. I have the DIV of the field to edit within a  of a table.
>
> Lets say you have something like this:
>
>    $(".editable").editable("http://www.example.com/save.php";, {
>        type   : 'textarea',
>        submit : 'OK',
>        cancel : 'cancel',
>        cssclass : "editable"
>    });
>
> Generated HTML would be like this:
>
> 
>    
>    OK
>    cancel
> 
>
> You should then be able to style buttons with something like:
>
> form.editable > button {
>    color : #F00
>
> }
>
> --
> Mika Tuupolahttp://www.appelsiini.net/


[jQuery] Jeditable - How to style a button using CSS

2009-05-28 Thread Charles

Hello all,

I am a newbie to jquery and jeditable. I have a select that is working
using jeditable. However, I cannot figure out how to style the submit
button. I have the DIV of the field to edit within a  of a table.

Anyone able to help me?

Thanks,
Charles


[jQuery] Jeditable - Need help understanding how the ID's are passed

2009-05-25 Thread Charles

Hello all,

I am trying to update a table with the record id for a priority
selected from another table. I don't understand how the record id for
the record I am trying to update is passed.

On my PHP page named "lead-001.php" I have the following:



$(document).ready(function() {
   $('.select_priority').editable('/lead/lead-006.php', {
  loadurl : '/lead/lead-005.php',
  indicator : '<img src="/images/spinner.gif">',
  type : 'select',
  onblur : 'cancel',
  submit : 'OK',
  tooltip : 'Click to edit...'
   });
});


With the field:


I am able to click on the field and select from the drop-down the
following values from "lead-005.php":
{"2":"High","4":"Low","3":"Medium","1":"Urgent","selected":"1"}

For troubleshooting I am just echoing the SQL in "lead-006.php".
Instead of getting something like this (where 2 is the record id for
the record I am trying to update):
"Update tblLeads set fldPriorityID = 4 where fldLeadID = 2;"

I get this:
"Update tblLeads set fldPriorityID = 4 where fldLeadID =
fldPriorityID;"

Why is this happening? How can I tell "lead-006.php" that I am trying
to update record with the id number 2.

Thanks,
Charles


[jQuery] Re: Calling PHP function with $.ajax()

2009-03-05 Thread Charles Liu
you can decide what you will do in php by the parameters from GET/POST
method
for example "url:inbox.php?act=delete&id=123"

and from the server side, it goes like:
$act = empty($_GET['act'])?'':$_GET['act'];
if($act=='delete'){
...
}

Hope this will be any help
Charles
2009/3/6 dawnerd 

>
> No, you cannot directly call php functions. That would be a very large
> security whole.
>
> Instead, you should be using query string parameters to figure out
> what action you want to perform in the php.
>
> On Mar 5, 12:10 pm, side1021  wrote:
> > Hi,
> >
> > Is there any way to call a php function directly with $.ajax()?  I did
> > some search and the answer I've got varies from impossible to using
> > workarounds such as passing query string to the 'data' and let php
> > direct which function to call.  I know that with asp.net it's possible
> > but i'm not familiar with PHP.  Here is the code that works for me in
> > asp.net.
> >
> >   $.ajax({
> >type: "POST",
> >url: "Default.asp/Book",
> >contentType: "application/json; charset=utf-8",
> >data: "{}",
> >dataType: "json",
> >success: AjaxSucceeded,
> >error: AjaxFailed
> >});
> >
> > Thanks!
>


[jQuery] Re: How to trigger "click" event in jquery

2009-03-05 Thread Charles Liu
hi Andy,
maybe i don't understand, but, since you bind function "A" to click event,
why don't you execute "A" directly instead of trigger

Charles
2009/3/6 Yun W 

>
> I have the same issue with the click on jQuery.
>
> When using $('#elmId').trigger('click'), it doesn't work on Google
> Chrome/Safari, but it does work on IE7/IE6.  No error is thrown.
> What's the problem?
>
> Thanks.
>
> On Mar 5, 3:56 am, Andy789  wrote:
> > Hi All,
> >
> > I am struggling with something very simple.
> >
> > 1. onclick event for li element is binded with mootools
> >
> > 2. I can easilytriggeronclick via function with mootools like
> >
> > $('lst4').fireEvent('click'); ///works fine
> >
> > 2. I cannottriggeronclick via jquery. I am trying
> >
> > function test(){
> > //$('lst4').fireEvent('click'); ///works OK, calling mootools
> > $j('#lst4').trigger('click');  // does not work, returns no errors
> >
> > }
> >
> > I am using both mootools ans jquery. $j relates to jquery (var $j =
> > jQuery.noConflict();)
> >
> > How can Itriggeronclick for that element programmatically with
> > jquery?


[jQuery] [validate] Group highlighting fix?

2009-03-05 Thread Jean-Charles S

I have a group of fields (field "301" and "306") that are two inline
select boxes to represent the month and year.  I've grouped them with
the proper validate hash object ("groups") and set the errorPlacement
to be after field "306."  All works fine as far as validation goes,
however I've also assigned a highlight function on the field's parent
element.  On all single fields, this works perfectly.  On the grouped
elements, however, if the first field is marked as invalid and the
second is marked as valid, highlight is called first for the first
field, highlighting the parent element, but then unhighlight is called
due to the second field and the parent element no longer has the
correct highlighting.

Is there anyway I can prevent this negating action from happening?  In
other words, prevent unhighlight from occuring as a result of the 2nd
field in the group technically being valid (yet the group is still
invalid)?


[jQuery] Re: how to add callback in the $.ajax ?

2009-03-04 Thread Charles Liu
try to track down the json data,so you can:
1.alert(data); before return (if it doesn't work see the following)
2.change the POST method to GET from the server side and then input all
paras into browser and see what will you get.(if it doesn't work see the
following)
3.track down something from the server side script

2009/3/5 Adwin Wijaya 

>
> nope, i want  to return as json.
>
> price was there because i was logging into console. just for
> debugging :) and i will do the calculation after it return the value.
>
> I tried using async:false
>
> and the result still undefined
>
> function getGoodsDetail(id){
> $.ajax({
>type: "POST",
>url : "/goods/detail/",
>data : "id="+id,
>dataType: "json",
>async:false,
>success : function(data){
> return data ;
>}
>});
> }
>
> var x = getGoodsDetail(10);
>
> any idea ?
>  I think i need to have callback so that I can return the value ...
> just like in $.post and $.get.
>
> is it possible ?
> thanks
>
>
>
>
> On Mar 5, 9:06 am, James  wrote:
> > But does it work with async set to false?
> > The code should work correctly if you have async set to false.
> > However, you cannot do this (return the JSON from the function)
> > properly without that setting set to false.
> >
> > By the way, is it suppose to be:
> > result = price;
> > ? I don't see what you're doing with the price variable in there.
> >
> > On Mar 4, 3:43 pm, Charles Liu  wrote:
> >
> > > hi Adwin,
> > > it is "undefined" because it runs before ajax is finished.
> > > maybe you should try to move "return result" next to the position of
> "result
> > > = data"
> >
> > > let me know if it works
> >
> > > Charles
> >
> > > 2009/3/5 Adwin Wijaya 
> >
> > > > Hi,
> >
> > > > can i have callback function on the $.ajax ?
> > > > I don't want to use async since it will block the browser ... so can
> i
> > > > use callback instead ?
> >
> > > > I would like to have function that return json like this
> >
> > > > function getGoodsDetail(id,member){
> > > >   var result ;
> > > >   $.ajax({
> > > >type: "POST",
> > > >url : "/goods/detail/",
> > > >data : "id="+id,
> > > >dataType: "json",
> > > >async:false,
> > > >success : function(data){
> > > >var price = 0 ;
> > > >if(member == 'Y'){
> > > > price = data.priceMember ;
> > > >}else{
> > > >price = data.priceNonMember;
> > > >}
> > > >// I want to return data to user
> > > >result = data
> > > >}
> > > >});
> > > > return result; // --> always undefined
> > > > }
> >
> > > > so when I call getGoodsDetail(id, membership) it will return json
> > > > value ...
>


[jQuery] Re: how to add callback in the $.ajax ?

2009-03-04 Thread Charles Liu
hi Adwin,
it is "undefined" because it runs before ajax is finished.
maybe you should try to move "return result" next to the position of "result
= data"

let me know if it works

Charles

2009/3/5 Adwin Wijaya 

>
> Hi,
>
> can i have callback function on the $.ajax ?
> I don't want to use async since it will block the browser ... so can i
> use callback instead ?
>
> I would like to have function that return json like this
>
> function getGoodsDetail(id,member){
>   var result ;
>   $.ajax({
>type: "POST",
>url : "/goods/detail/",
>data : "id="+id,
>dataType: "json",
>async:false,
>success : function(data){
>var price = 0 ;
>if(member == 'Y'){
> price = data.priceMember ;
>}else{
>price = data.priceNonMember;
>}
>// I want to return data to user
>result = data
>}
>});
> return result; // --> always undefined
> }
>
> so when I call getGoodsDetail(id, membership) it will return json
> value ...
>


[jQuery] Re: I need a jsonp example

2009-03-03 Thread Charles Liu

usually you should use $.getJSON when you need jsonp to get data from
another domain

On 3月3日, 上午8时17分, craigpierce  wrote:
> Hi All -
>
> I'm fairly new to jQuery, and totally new to jsonp.  I would like to
> see an example of an $.ajax call using jsonp - as of right now, this
> is what I have tried (based on examples found via Google searches and
> the text description on the $.ajax page), but nothing fires any of the
> callbacks:
>
> One:
> function test(){
> var jsonObj ={
> dataOne: "foo",
> dataTwo: "foo",
> };
>
> $.ajax({
> type:  "GET",
> url: "https:myurl.com",
> dataType:   "jsonp",
> data:  jsonObj,
> error:  function(){alert('bad');},
> success:function(){alert('good');},
> complete:   function(){alert('foo');}
> });
>
> }
>
> Two:
> function test(){
> var jsonObj ={
> dataOne: "foo",
> dataTwo: "foo",
> };
>
> $.ajax({
> type:  "GET",
> url: "https:myurl.com",
> dataType:   "jsonp",
> jsonp:"testCallback",
> data:  jsonObj
> });
>
> }
>
> function testCallback(){alert('foo');}
>
> Three:
> function test(){
> var jsonObj ={
> dataOne: "foo",
> dataTwo: "foo",
> };
>
> $.ajax({
> type:  "GET",
> url: "https:myurl.com?testCallback=?",
> dataType:   "jsonp",
> data:  jsonObj
> });
>
> }
>
> function testCallback(){alert('foo');}
>
> Four:
> function test(){
> var jsonObj ={
> dataOne: "foo",
> dataTwo: "foo",
> };
>
> $.ajax({
> type:  "GET",
> url: "https:myurl.com?callback=testCallback",
> dataType:   "jsonp",
> data:  jsonObj
> });
>
> }
>
> function testCallback(){alert('foo');}
>
> Any help would be much appreciated!  Thanks!!!


[jQuery] Re: Form inside Form value

2009-02-27 Thread Charles Liu
1st, why do you use 2 forms together?
2nd, when you say "email filed", do you mean "" ? if so,
you can use $("#form2_id").find('input[name="email"]').get(0).val();

maybe not so accurate, hope it'll be any help.

Charles

2009/2/27 Po01 

>
> Hi, i have a HTML like that:
>
> 
> 
> 
> 
> 
>
> Supposing the field name is email, how can i get its value using
> Javascript/JQuery?
> I tried some stuff.. without success..
>
> The form 2 name Im getting as a variable, like:
> function values(id)
> {
> var ID = id;
> var Form2 = "#form2_" + ID;
> ...
> }
>
> So i need a code that use this Form2 to get the email field value
> inside it.
> Tried some stuff but dunno how to do that when Form2 is inside Form1.
>
> Thanks.


[jQuery] Re: I want to do validation via AJAX and then submit form...

2009-02-26 Thread Charles Liu
i think you can :
1. put the new page in the action (as you said) , run the "submit" function
of the form when the ajax response is correct
2. run "top.location= the new page" when the ajax response is correct

warning: newbie's suggestions above ;)

2009/2/27 Coder 

>
> I need the answer of this question
>
> On Feb 23, 10:13 pm, "webspee...@gmail.com" 
> wrote:
> > Hey all.
> >
> > I am creating a login type screen and when the login button is
> > clicked, I validate the ID/password via AJAX and if successful, I then
> > submit the form.
> >
> > I have the code to validate, but when it returns a true, how do I
> > submit the form to call the new page? Do I put the new page in the
> > action of the form and simply call the submit function for the form?
> > Or is there a way to use "load" in a post where it calls a program
> > rather than loads the url into a div?
> >
> > ...
>


[jQuery] Re: Help for beginners. Inspecting objects.

2009-02-26 Thread Charles Liu
btw, usually you should focus on the property "target" which contains all
html properties

2009/2/27 Charles Liu 

> function get(obj)
> {
>   var str;
>   for(var i in obj)
>
>   str+=i+"="+obj[i]+";\n"
>
>   alert(str);
> }
>
>
>
> 2009/2/27 Sonya 
>
>
>> Hello,
>>
>> I just begin to work with jQuery and have some questions. Where I can
>> find a list of all properties for elements. E.g. I generate a list
>> item:
>> var list = document.createElement("li");
>>
>> How can I fill in in the list? list.text doesn't work. I have to guess
>> again and again for each element which properties it has. Is there an
>> API where I can see all properties of the object?
>>
>> Thank you,
>> Sonya
>>
>
>


[jQuery] Re: Help for beginners. Inspecting objects.

2009-02-26 Thread Charles Liu
function get(obj)
{
var str;
for(var i in obj)
str+=i+"="+obj[i]+";\n"
alert(str);
}



2009/2/27 Sonya 

>
> Hello,
>
> I just begin to work with jQuery and have some questions. Where I can
> find a list of all properties for elements. E.g. I generate a list
> item:
> var list = document.createElement("li");
>
> How can I fill in in the list? list.text doesn't work. I have to guess
> again and again for each element which properties it has. Is there an
> API where I can see all properties of the object?
>
> Thank you,
> Sonya
>


[jQuery] Re: asynchronous, IE, and BlockUI

2009-02-16 Thread Charles H

Mike:

If you are validating a form before submitting, or doing validation in
a link onclick, you could do synchronous ajax, and when it returns, it
could have an event bubble boolean.  If return true, then everything
is ok, continue submitting the form or clicking the button, if false,
then things are not ok, Ajax should popup a dialog and the user can
correct things.  Granted you could do async, then the ajax coming back
could just do a form.submit, but why not give people options?  When
doing a synchronous ajax call, the blockUI indicator should appear on
the screen so the user knows whats going on.  Can this be made to
work?

Thanks,
Chris Hyzer

On Feb 13, 7:26 pm, Mike Alsup  wrote:
> > I have the exact same problem as this post below from a while back,
> > which got no valid response. The reason that I need to usesynchronous
> > calls is that on some ajax submittals we either submit the entire page
> > or return a message to the user, depending on validations -
> > asynchronous will not work for my purposes.
>
> Why woudn't async work?  That's the driving purpose behind blockUI in
> the first place.  To put up a message while waiting for an async
> callback.  As far as I'm concerned there is no valid use case for
> using sync ajax.  None.  Nada.  Zero.
>
> Mike


[jQuery] asynchronous, IE, and BlockUI

2009-02-13 Thread Charles H

I have the exact same problem as this post below from a while back,
which got no valid response. The reason that I need to use synchronous
calls is that on some ajax submittals we either submit the entire page
or return a message to the user, depending on validations -
asynchronous will not work for my purposes. Does anyone have any
advice on getting BlockUI to work in this scenario?

Thanks in advance for your feedback!

The original post:

BlockUI doesn't want to load correctly in IE. The JQuery routine I'm
running contains an Ajax call that takes a while. I call .blockUI
before calling a synchronous Ajax call and .unblockUI afterwards. It
works as expected in FF but in IE (both 6 and 7) the screen freezes
until the Ajax call completes then shows the BlockUI message for a
brief second.

I'm using JQuery 1.2.6 and BlockUI 2.0

Here is the basic gist of my code

$.blockUI({message: 'Compiling data for your report...please wait.'});

$.ajax({type: "POST", url: "sample.htm", async: false});
$.unblockUI();

As I mentioned the Ajax call can take upwards of 15 seconds. I've
tried the following to no avail:
- I set the block/unblock call in ajaxStart and ajaxStop
- I changed the page header from transitional to strict
- I used setTimeout to try to stall the Ajax call (thinking the
browser animation just needed time to load)
- I set a delay on "sample.htm" to ensure it would load nothing for 5
seconds



[jQuery] jQuery onunload

2009-01-19 Thread Charles Johnson

My site runs on quite a bit of jQuery-based Javascript, and
occasionally I'll receive a complaint from a reader that their browser
goes into an infinite loop and throws a script timeout error, when
they follow a link that takes them away from the page.

I'm assuming this has something to do with jQuery's removal of event
handlers when the page is unloaded; i.e. this code in 1.2.6:

// Prevent memory leaks in IE
// And prevent errors on refresh with events like mouseover in other
browsers
// Window isn't included so as not to unbind existing unload events
jQuery(window).bind("unload", function() {
jQuery("*").add(document).unbind();
});

Today someone complained of seeing this script timeout in Firefox 3.
Is there something I can do to prevent this? There are a lot of
dynamic elements in the site, and event handlers are being installed
on the fly, but I also use the unbind() method before replacing any
HTML and installing new handlers -- so I'm pretty sure there aren't
orphaned bits of event-bound HTML floating around. Any ideas are
welcome...


[jQuery] Re: Detecting pressed keys (not keypress, but if it's already pressed)

2008-06-30 Thread Charles Sexton

Anyone?

On May 28, 12:11 pm, Charles Sexton <[EMAIL PROTECTED]> wrote:
> Hi guys and girls,
>
> I don't know if this is possible, but I'm aiming to detect whether or
> not a key is pressed, as in the key is already pressed when the page
> loads.
>
> My application changes the page when Ctrl+arrow is pressed, but
> without being able to detect whether Ctrl is still pressed when the
> next page loads, both keys have to be pressed again.
>
> So is there any way to detect if a key is currently pressed, but the
> keystroke occurred before the page loaded?
>
> Many thanks to all who help,
>
> Charles


[jQuery] Detecting pressed keys (not keypress, but if it's already pressed)

2008-05-28 Thread Charles Sexton

Hi guys and girls,

I don't know if this is possible, but I'm aiming to detect whether or
not a key is pressed, as in the key is already pressed when the page
loads.

My application changes the page when Ctrl+arrow is pressed, but
without being able to detect whether Ctrl is still pressed when the
next page loads, both keys have to be pressed again.

So is there any way to detect if a key is currently pressed, but the
keystroke occurred before the page loaded?

Many thanks to all who help,

Charles


[jQuery] Re: Div Changer Using Hide And Show

2008-02-22 Thread Charles Stuart

This is quite generalized and is bookmarkable...
- http://enure.net/dev/hide-all-except-one/



On Fri, Feb 22, 2008 at 6:50 AM, J Moore <[EMAIL PROTECTED]> wrote:
>
>
>  good tips so far.
>
>  I just wanted to add that using classes and ids works well.
>
>  show blackbook
>  show redbook
>
>  blackbook stuff...  div>
>  redbook stuff...
>
>  This makes your click function simpler.
>
>  $('a.show').click(function(){
>
> hide_divs();
> var x = $(this).attr('id');
> $('#'+ x + '-content').show('fast');
> return false;
>  });
>
>  The hide_divs method is also a bit simpler.
>
>  var hide_divs = function(){
> $('div.book').hide('fast');
>  };
>
>  You might notice that the div has a "hidden" class. This just makes
>  initialization simpler, since the items are hidden on page load. The
>  css would be something like:
>
>  div.hidden { display: none; }
>
>  -j
>
>
>
>  On Feb 22, 4:02 am, andrea varnier <[EMAIL PROTECTED]> wrote:
>  > On 21 Feb, 23:03, Sientz <[EMAIL PROTECTED]> wrote:
>  >
>  > >   $('a#blackbook').click(function() {
>  > > //HIDE DIVS
>  > > hide_divs();
>  > > //SHOW LISTED DIV
>  > > $('.blackbook').show('fast');
>  > > return false;
>  > >   });
>  >
>  > you see you got all these functions that basically do the same thing.
>  > if an anchor has an id, they show the corresponding div
>  >
>  > I think you could do it like this
>  >
>  > $('a[id]').click(function(){
>  > hide_divs();
>  > var x = $(this).attr('id');
>  > $('div[class=" + x + "]').show('fast');
>  > return false;
>  >
>  > });
>  >
>  > and should do the same thing.
>  > but you could go further, and use classes in a different way.
>  > let's say that instead of calling them divs with 'human' names, we can
>  > use more 'efficient' names, like:
>  >
>  > hs_a
>  > hs_b
>  > hs_c
>  > hs_d
>  > ...
>  > where hs stands for hide/show (just an example).
>  > in this way the function hide_divs becomes something like
>  >
>  > var hide_divs = function(){
>  > $('div[class^="hs"]').hide('fast');  /* this selector looks for
>  > the div(s) that have a classname that starts with the string 'hs' */
>  >
>  > };
>  >
>  > then you give corresponding id's to the anchors, so the other on I
>  > wrote before:
>  >
>  > $('a[id^="hs"]').click(function(){
>  > hide_divs();
>  > var x = $(this).attr('id');
>  > $('div[class=" + x + "]').show('fast');
>  > return false;});
>


[jQuery] Re: Can JQuery support iCab 3 (for legacy Mac OS9)

2008-02-18 Thread Charles Stuart

Since this page (http://docs.jquery.com/Browser_Compatibility) and
your post do not agree, could you clarify if Firefox 1.5+ on Mac OS X
is supported?

best,
Charles



On Jan 8, 7:06 am, "John Resig" <[EMAIL PROTECTED]> wrote:
> Nope, definitely not. We already don't support anything less than
> Safari 2 - or IE 5. The only Mac-based browsers we support are Safari
> 2 + 3, Firefox 2, and Opera 9.
>
> --John
>
> On Jan 7, 2008 11:49 PM, howa <[EMAIL PROTECTED]> wrote:
>
>
>
> > We have some users still running OS9, I would like to know if any OS9
> > users here can confirm if JQuery (1.2x) support iCab 3, so we can
> > advise them to use this browser.
>
> >http://www.icab.de/dl.php
>
> > Thanks.


[jQuery] Re: Is there a feature as addID like addClass in jQuery?

2008-02-09 Thread Charles K. Clarkson

mtest wrote:

: How I can add ID like I add class by function addClass?

You can't. IDs are one-to-one relationships with their tags.
addClass adds a class to a tag which may already have another
class. Each tag can have many classes.

An addID method would allow more than one ID per tag, which
breaks the rules of CSS. What your example implies is that you 
need a way to change an ID attribute to a set of html tags.


: For example i have:
: 
: Some text #1
: Some text #2
: 
: And i want see this result:
: Some text #1
: Some text #2
: 
: I don't know how make this, please help.
: Maybe like this :):
: 
: $(document).ready(function() {
:var i = 1;
:$("div").each(function(){
:this.addID("Div"+ "1");
:});
: });


$(document).ready(function(){
$('div').each( function(i){
$(this).attr({ id: 'div' + ++i });
})
});

HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: changing the selected option in a select

2008-02-08 Thread Charles K. Clarkson

rolfsf wrote:

: this didn't work (as well as several other variations):
: $('a.cancel').click( function(){
: $('select option[value=0]').attr("selected","selected");
: });
: 
: can someone clue me in?

$('a.cancel').click( function(){
$('select').val('--');
});



HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: Thickbox Alternative that Works with jQuery

2008-02-07 Thread Charles K. Clarkson

Andy Matthews wrote:

: If you like Thickbox, why are you looking for something different?

The grass is always greener on the other side of the browser.



HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: Accessing un-parented text inside a known object

2008-02-06 Thread Charles K. Clarkson

sparkpool wrote:

: This finds span.bar, as I expected, but not what I want:
: jQuery('#zzz :first')

$('#foo').contents().get(0)

.contents() is used to get childNodes.

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


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/

Don't tread on my bandwidth. Trim your posts.



[jQuery] Re: Problems appending inputs with quotes in the value

2008-02-06 Thread Charles K. Clarkson

benjam wrote:

: i.e.- If I try something like the following:
: 
: $('form').append('');
:
: The element that gets appended to the form has the following html:

   You could use a single quote as a delimeter.

$('form').append('');


But that looks mighty ugly. You could change the quoted quotes to
an html entity.

$('form').append('');



HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: Computing value for css key

2008-02-06 Thread Charles K. Clarkson

praxis wrote:

: $("div#lt").css("left", eval(parseInt($
: ("div#content").css("left"))-24));
: 
: The problem is, I can't get it to happen.

("div#content").css("left") may be returning "auto" instead of
a dimension. Can you provide an example page that illustrates the
problem?


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: getting the ID number of a cloned table row

2008-02-05 Thread Charles K. Clarkson

Bruce MacKay wrote:
: Hello folks,
: 
: I'm trying to duplicate a row of an existing table using a function
: adapted from
: http://www.nabble.com/Add-Table-row-to12989886s27240.html#a13300133  
: 
: My problem is that I cannot identify the identifier of the last row
: (of the original table).

From the html you provided, this gets the last ID. 

// The match should return an array with the current id in the 0
// position. The "+" sign in front converts this ID to a number.
var currentID = + $(clonedRow).find('input').attr('id').match( /\d+/
)[0];
var newID = currentID + 1;

The problem is that clone() does not work right in Internet Exploder.
There's a patch due, but no advance yet. So, the solution works on FF,
but not on IE. (http://www.fusioncube.net/?p=196)

In fact, the method above needs filter() to work on IE.

// Solution for IE.
var currentID = + $(clonedRow).filter('input').attr('id').match( /\d+/
)[0];
var newID = currentID + 1;


: function duplicateRow(){
[snip]


Manipulating the html directly probably isn't the most jQuery-ish
way to handle this.

$(clonedRow).find( '#bc' + currentID ).eq(0).attr({
id: 'bc'  + newID,
name: 'correctans' + newID
});

$(clonedRow).find( '#theans' + currentID ).eq(0).attr({
id: 'theans'  + newID,
name: 'answer' + newID
});

$(clonedRow).find( '#fb' + currentID ).eq(0).attr({
id: 'fb'  + newID,
name: 'feedback' + newID
});

// Add to the new row to the original table
$( "#myTable").append( clonedRow );





So, for now, you may need another solution besides clone().


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: New to jquery. Things just don't work.

2008-02-03 Thread Charles K. Clarkson

Sathya wrote:

: ${'a'}.click(function() {

That should be:

 $('a').click(function() {


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/




[jQuery] Is it possible to auto increment an appended value?

2008-02-02 Thread Charles K. Clarkson

Gorkfu wrote:

: How would I create a cap to put on the counter, so it doesn't go
: higher than 250? Thanks

Can you update us n the code you are using now and how (or why)
you would want to add a cap?

Two possibilities come to mind. Create an object that checks
itself as it changes or just check the value after each increment.
I tend to lean toward objects, but they tend to take more time to
write. Knowing the context of the limitation (or cap) would help a
lot.


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: can't access any plugins from within function

2008-02-01 Thread Charles K. Clarkson

ajpiano wrote:
: i'm in the midst of developing an application with many jquery
: plugins, and i've just run into a bizarre problem.  my app uses a lot
: of ajax to populate different divs that i'm sorting using sortable.
: anyhow, the issue is as follows.

Can you provide an actual example of the problem? Perhaps a link
to your app?


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: Interface Plugin for Jquery

2008-01-31 Thread Charles K. Clarkson

[EMAIL PROTECTED] wrote:

:  I start getting errors in my firefoy error console.
: Can someone please tell how can i solve this problem .

What errors are you getting?



HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: Fighting a closure

2008-01-31 Thread Charles K. Clarkson

timothytoe wrote:

: This next one is obviously a work of JavaScript art (as opposed to the
: former, which is a more jQuery solution).

Actually, it's very jQuery-ish. We can use a similar form to add
custom methods to the jQuery object.



: Does anyone want to explain it?
: 
:  for ( i=0;i<5;i++ ) {
: (function(num) {
: $("#port"+num).click(function() { bigchart(num) });
: })(i);
:  }

In javascript, you can force a block of code to run by wrapping it in
two sets of parentheses ( ... code ... )(). For example, this function will
not run
until it is called and being anonymous (it has not been assigned to a
variable) there is no way to call it:

function(num) {
   $("#port"+num).click(function() { bigchart(num) });
};

But, if I wrap it in parenthesis like this, it will run as it is
encountered.

(function(num) {
   $("#port"+num).click(function() { bigchart(num) });
})();

The problem is that num remains undefined. To define it we can pass
a value in the second parenthesis. This set of five routines will run
for each value 0 through 4.

(function(num) {
   $("#port"+num).click(function() { bigchart(num) });
})(0);

(function(num) {
   $("#port"+num).click(function() { bigchart(num) });
})(1);

(function(num) {
   $("#port"+num).click(function() { bigchart(num) });
})(2);

(function(num) {
   $("#port"+num).click(function() { bigchart(num) });
})(3);

(function(num) {
   $("#port"+num).click(function() { bigchart(num) });
})(4);

That's an awful lot to type. To bad we aren't programmers, then we
could write a loop to step through the values passed to ... Hey, we are
programmers! Carpenters of the future and all that.

for ( i = 0; i < 5 ;i++ ) {
   (function(num) {
   $("#port"+num).click(function() { bigchart(num) });
   })(i);
}


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: attr ie bug

2008-01-31 Thread Charles K. Clarkson

hcvitto wrote:

: hi i'm using this code to add the target=_blank attribute to links.
: 
: $("a[href]").each(function(){
:   if ($(this).hasClass("ppt") || $(this).hasClass("pdf") || $
: (this).hasClass("allegato") || $(this).hasClass("doc") || $
: (this).hasClass("jpg") || $(this).hasClass("xls") || $
: (this).hasClass("external") || $(this).hasClass("zip")){
: $(this).attr("target","_blank");
:   }
:   });
: 
: it works fine in firefox but not with ie which throws a javascript
: error i can't identify.

It works on IE6 on windows XP.

HTH,


Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: Not a plugin but code for anyone trying to have collapse-able menu with cookies

2008-01-31 Thread Charles K. Clarkson

Karl Swedberg wrote:

: On my test page (http://test.learningjquery.com/cookie-menu.html), I
: put a link to another page with the same script and menu so you can
: see the persistence of the expand/collapse state.

Never being able to leave well enough alone and having a little time
on my hands, I squeezed the cookie information into a separate object.
By calling an instance of it (using new) we can easily have multiple
menus on a page.

Here is the beginning of the cookieMenu code:

$.fn.cookieMenu = function(cookieName){

var $topLevel = this.find('li ul');
$topLevel.hide();

var menuCookie = new $.cookie.menu(cookieName);
menuCookie.showCookie();


Using a cookie object reduced the size of each click function. The
bigIndex() function is a private method of the $.cookie.menu object.

var $this = $(this), $checkElement = $this.next('ul');

if ( menuCookie.isOpen(index) ) {
$checkElement.show();
}
$this.click(function() {
if ($checkElement.is(':hidden')) {
$checkElement.slideDown();
menuCookie.open(index);

} else {
$checkElement.slideUp();
menuCookie.close(index);
}
menuCookie.showCookie();
return false;
});


I also made calling the menus little simpler. It assumes the
structure of the menu is a simple unordered list of lists like we have
been using.





$(document).ready(function() {

$('#menu-1').cookieMenu('cookie-1');
$('#menu-2').cookieMenu('cookie-2');

});



There are three menus on my test page. The top menu is the same on
both pages while the bottom one on each page use different cookies.

http://www.clarksonenergyhomes.com/demos/jq/cookie-menu.html


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: jquery VS internet explorer

2008-01-29 Thread Charles K. Clarkson

ZiTAL wrote:

: Hi, i have done a very simple example of jquery slide, but it doesn't
: work correctly in internet explorer, it blinks in the beginning and at
: the end. Thanks for all (sorry for my bad english).
: 
: link:
: http://zital.no-ip.org/jquery/

[gets on soap box]

Always, always, always start with well formed html(xhtml). Validate it
to be certain that is not the problem. The DOM depends on you knowing how
to write well formed markup. If you don't write it, the browser makes stuff
up to fill in any missing pieces. When the browser guesses wrong, your code
and markup often fail. Browsers guess wrong a lot.


Get out of Quirks mode and specifically define the character encoding.
This will solve a lot of cross browser problems. Use a DOCTYPE at the top
of all your xhtml (and html) pages (see this url for xhtml:
http://www.w3schools.com/tags/tag_doctype.asp). Here is the xhtml
Transitional DOCTYPE declaration. It will get you out of Quirks mode.

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>



Use a character encoding in the header. There are a lot of different
encodings out there. I find utf-8 to my liking. Do a search for other
character encodings.




This will solve many of the problems you have with IE 6. Including
the one you presented here. If you have a cross browser problem, go
validate your page, first. Validate the css and html(xhtml). Fix the
validation problems and see if the other problem is still happening. You
may be surprised by the result.

I think I have learned more about css and html from validating (and
repairing) my pages than from any other single source. I have gotten so
anal about it that I created a custom DTD for one client.

[gets off soap box]

I tested your script with this header and IE6 performed fine. I am
using the jquery version 1.2.2. I didn't test your page using your source.
.

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>


Foo




[jQuery] Re: IE7 it does't work (bug?)

2008-01-29 Thread Charles K. Clarkson

mixfox wrote:

: here is my code
: 
: $(document).ready(function() { $('#imageid').load(function(){
: 
: alert('hello');
: 
: }); });
: 
: "#imageid" is an img lable's ID

That works for me. Perhaps the error is in the html portion of your
page.
Are you sure the image has an id of id="imageid"? id="#imageid" will fail.
If you cannot fix the problem show us your whole page.


http://www.dfwrein.com/html4-embed.dtd";>


Foo




$(document).ready(function() {
$('#imageid').load(function(){
    alert('hello');
});
});









HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] RE: Is it possible to auto increment an appended value?

2008-01-28 Thread Charles K. Clarkson

Gorkfu wrote:

: Thanks, Charles this code helps a lot. I understand how it works.

You're welcome.


: However its giving me one parse error with the line with a single
: double quote as showen below. Is it possible to combine the 2 lines
: below or escape the double quote?
: 
: --- Code ---
: 
: extrafield += ' value="' + padded_counter;
: extrafield += '->EditValue ?>">';


I only added the extra "+=" statements to avoid line wrapping
in the email. You could expand it all back out to how you had it or
like this.

extrafield += ' value="' + padded_counter +
'->EditValue ?>">';

But I don't know why there is a parse error on the double quotes.
You might have picked up a stray character in the copy and paste
from the email. Run your code through a lint program. I use this one
for javascript: http://www.javascriptlint.com/


: I'm not familiar with escaping in javascript like in php, thanks.

The escape character for javascript is the backslash (\). I
looked it up a few days ago as I am spoiled by Perl and it's boatload
of quoting operators. Javascript quoting is lie going back to
Commodore BASIC. :(


extrafield += ' value=\"' + padded_counter;
extrafield += '->EditValue ?>\">';


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/




[jQuery] Re: Superfish problem with IE7

2008-01-28 Thread Charles K. Clarkson

eugene33 wrote:

: I have a little problem with superfish and IE7 (probably IE6 too
: couldn't test it)

It fails under IE6 as well.

The problem seems to be the relative positioning of the #content.
The default is static positioning works fine. The relative position is
causing the problem.

As is:

 div#content {
position: relative;
display: block;
float: left;
width: 480px;
min-height: 642px;
padding: 10px;
background: #F1EDE1;
border-left: 1px solid #ED;
}

Repaired:

 div#content {
position: static;
display: block;
float: left;
width: 480px;
min-height: 642px;
padding: 10px;
background: #F1EDE1;
border-left: 1px solid #ED;
}

According to the docs, the superfish author watches this list. He
may have some insight on exactly how to keep the relative positioning
and the menu. I suspect the menu normally displays fine, but under the
#content due to its positioning.


BTW, I solved this problem by backing out all the stylesheets except
the superfish one. I tested the page and the menu worked in IE. Then I
added stylesheets back in until I isolated the layout stylesheet. Did
more testing. Next I guessed about blocking out whole sections of style
in the layout css and found the above block. Then isolated the problem
line.

This process is an old program debugging technique. Get down to
something that works, and then slowly heap the frills on until you find
the error again. For simple problems, the last thing you added on is the
most likely culprit. It's a tedious process, but it gets the job done.


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: Is it possible to auto increment an appended value?

2008-01-27 Thread Charles K. Clarkson

[EMAIL PROTECTED] wrote:


: Is it possible to auto increment the value on a variable that will be
: appended?

Yes. We would need to use a closure to preserve the value of the
counter between clicks. The function in the $(document).ready section
can act as the closure.


: For example the bottom code I'm appending an extra row with a text
: field to the table once the fields button is clicked. I want the
" data for every "c#" sign to count up from 1, 2, 3, etc... Any ideas
: appreciated, thanks.
: 
: Further Note: If the auto increment is possible, could I do it as 001,
: 002, 003... Thanks.

I included a function to do that. It relies on adding a repeat
method to the built-in String object.


: --- Code  ---

(function($) {

// Add repeat method to String object
String.prototype.repeat = function(n){
return new Array(n + 1).join(this);
};

// Add leading_zeros method to jQuery
$.leading_zeros = function(n, total_digits){
n = n.toString();
return '0'.repeat(total_digits - n.length) + n;
};

})(jQuery);

$(document).ready(function(){

// initialize the counter
var counter = 0;

$('#fields-button').click(function(){

// increment and pad the counter
var padded_counter = $.leading_zeros(++counter, 3);

// create the new field
var extrafield = 'List Item ' + padded_counter +
'';
    extrafield += '
Add Field




HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: http://jquery.com/api/ page broken

2008-01-27 Thread Charles K. Clarkson

Yansky wrote:

: Hmm weird. I tried it in Opera on my machine and Firefox and IE7 on
: another machine and it didn't work with any of them.

I tried it again just now (7:57pm CST) with the cache disabled and,
while it took a while to load, it still worked fine.

Perhaps you are in the Twilight Zone.


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: http://jquery.com/api/ page broken

2008-01-26 Thread Charles K. Clarkson

Yansky wrote:
: The http://jquery.com/api/ page doesn't seem to be working for me.
: When I click on a link, nothing happens.
: 
: I'm using Firefox on Windows XP.

Works for me on Firefox 2.0.0.11 and XP. It's a little slow
loading at first. Clicking on a link slides down the detail.

HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: Selecting listboxes that are in a table

2008-01-24 Thread Charles K. Clarkson

MorningZ wrote:

: Shouldn't
: 
::  $("#ColumnEdit > select")
: 
: Provide me a jQuery array of those  boxes?

No. $("#ColumnEdit select") should.


HTH,


Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: simplier, more unobtrusiv?

2008-01-24 Thread Charles K. Clarkson

tlob wrote:

: 1Page with 4 Divs
: 
: 
: LOGO <-- click on that it fades away and go to div#content
: 
: 
: 
: Homepage
: Link Sandra<-click, this div fades away, div#sandra is shown
: Link Ahmed<-click, this div fades away, div#ahmed is shown
: 
: 
: 
: sandra
: Link Home<-click, this div fades away, div#content is shown
: 
: 
: 
: ahmed
: Link Home<-click, this div fades away, div#content is shown
: 
[snip code]

: 
: the links look like this:
: Home , etc...

Can you show us the relevant part of the actual mark up you
are using?


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: tabs display IE versus Firefox

2008-01-24 Thread Charles K. Clarkson

MikeP wrote:

: Hello. My tabs are functional in both IE and Firefox. However, the
: look inside the tabs is different.

: The words are appearing in white in IE and dark blue in Firefox. I've
: tried removing all the other styles on my page and it didn't seem to
: do anything.
: 
: Could it have something to do with Unordered Lists?

I notice you are using a Quirks mode DOCTYPE. Have you tried a
Standards Compliance Mode DOCTYPE?

Consider validating your page. You have mixed styles in your
page. For example, some meta tags use xhtml markup while the page
uses html 4.01 Transitional and there is no character encoding
statement. The validator may help you with that.

http://validator.w3.org/

Starting with a validated, Standards compliance mode page is your
best bet to tracking down weird CSS problems.

Quirks Mode (Current):




Southeastern Equity Center


Standards Compliance Mode (Suggested):

http://www.w3.org/TR/html4/loose.dtd";>



Southeastern Equity Center

I tested your page with the above doctype/character encoding
and corrected some of the  tags and got back to the blue
(#27537a) tab color in IE 6. I suspect the problem is a Quirks
mode problem.



HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: Adding CSS-property & therefore traveling the DOM - Problem.

2008-01-23 Thread Charles K. Clarkson

Jayzon wrote:

: 
:   
:   
:   
:   
:   
:   
:   Mister X
:   Info 1
:   Info 2
:   Info 3
:   [EMAIL PROTECTED]
:   
:   
[snip]

: I tried to do this with the following code:
:
: $(document).ready(function(){
:   $("a.email").hover(
:   function () {
:   $(this).prev("a").css({"margin-left":"-210px"});
:   },
:   function () {
:   $(this).prev("a").css({"margin-left":"-210px"}).remove();
:   }
:   );
: });
:
[snip]

: Since I'm totally new to jQuery, I tried to copy/paste the code from
: the documentation and fit it to my needs. This didn't work out & I
: have no idea how to achieve the desired effect.

According to the docs, .remove() is used to "remove all matched
elements from the DOM." CSS is not an element. It is a style. So you
cannot use .remove() to remove a style.

There are two problems with your example. First, there is no "email"
class in the markup. So there will never be a match as you have the
selector ("a.email") written above. Also, there is only one anchor
element in the document. There is no anchor previous to the anchor
selected. So I assume you are looking for a hover over the image.

This worked in my tests:

$(document).ready(function(){

$( '.memberpic > a > img' ).hover(
function () {
$(this).parent().css( 'margin-left', '-210px' );
},
function () {
$(this).parent().css( 'margin-left', '' );
}
);
});

I could have used a shorter selector ('memberpic img'), but the
selector above indicates which element is the parent of the img element.
Note that if your image is 210 pixels or less then the second function
will be triggered as the image moves to the left.

A simpler approach might be to select the anchor in the first place.
The :has() selector comes in handy here. This allows future expansion
of the div with additional text without breaking this selector.

$( '.memberpic a:has(img)' ).hover(
function () {
$(this).css( 'margin-left', '-210px' );
},
function () {
$(this).css( 'margin-left', '' );
}
);


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] Re: Anyone seen "toggleClass is not defined"

2008-01-22 Thread Charles K. Clarkson

hotsauce wrote:

: I keep receiving an error with this bit of code on click
: 
:  $(document).ready(function() {
:$('div.example').click( function() {
:   $(this).toggleClass("activated");
:});
:  });
: 
: It works, but I keep receiving an error stating that
: "toggleClass is not defined"
:
: How would I define this?

toggleClass is defined in jQuery. If it is not defined, you
have not loaded the jQuery library or you are using a version
which does not have that function. Check your path to the
library in your meta tags.

Otherwise, present a complete example (html and code) which
raises the same error you are receiving. In my tests (v1.2.2), I
could not reproduce your error.



Foo


$(document).ready(function() {
$('div.example').click( function() {
$(this).toggleClass('activated');
});
});


.example { background-color: #cc; }
.activated { background-color: #ff; }



Example




HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/



[jQuery] ui.datepicker causes IE "operation aborted"

2007-12-08 Thread Charles Johnson

I believe this bug was supposed to have been fixed in the move from
jQuery Calendar to ui.datepicker, but I'm still seeing sporadic
"Operation Aborted" errors in Internet Explorer, both 6 and 7, when
the datepicker is initialized. Frustrating problem because it's very
intermittent.

The code I'm using is pretty simple; in the HTML:



Then in the $(document).ready function, I instantiate the datepicker
with this:

$('#calendarDaily').datepicker({
showOn: 'button',
speed: 'fast',
buttonImageOnly: true,
buttonImage: '/dailyarchives.jpg',
buttonText: 'Calendar',
minDate: new Date(2001, 2 - 1, 7),
dateFormat: 'YMD-',
onSelect: function(thedate) {
eval("parent.location='/index.php?date=" + thedate + "'");
}
});

Works fine in all flavors of Mozilla/Firefox, and in Safari -- IE is
the only problem.


[jQuery] Help understanding bind and adding to the DOM.

2007-11-02 Thread Charles Sexton

Hello everyone,

>From this thread: 
>http://groups.google.com/group/jquery-dev/browse_thread/thread/22c0b936d2060dc4/
I now know what I need to accomplish, however I do not understand how
it works. Would someone be able to explain simply how to add data to
the DOM?
I had a quick look at Live Query as I thought it would be simple to
use (i.e. just include it and everything works), but I don't find it
to be simple at all. Maybe I will once I understand the concept.

Many thanks



[jQuery] Re: Hovering over jQuery retrieved HTML

2007-10-29 Thread Charles Sexton

Am I asking this question in the wrong place? Where would I go to get
responses?



[jQuery] Re: Hovering over jQuery retrieved HTML

2007-10-26 Thread Charles Sexton

Hi Jolyon,

I believe that's exactly what I'm doing, as it works perfectly fine
for the first dropdown. It's when jQuery is told to look at HTML
gained via Ajax that I begin to see a problem, but only with mouse
gestures. The key functions work perfectly fine.

Here's the code for the first dropdown (sites), which looks at HTML
generated with the page, and the second dropdown (eaas), which looks
at Javascript written HTML.

// Display the list of sites in a dropdown when the form field is
focused on.
$(".activate_site_list").focus(function() {
$("#site_list_dropdown").slideDown('fast');
}).blur(function() {
$("#site_list_dropdown").slideUp('fast');
});
// Display a nice hover colour when the sites are focused on.
$("#site_list_dropdown").find("li").hover(function() {
$("#site_list_dropdown").find(".hover").removeClass("hover");
$(this).addClass("hover");
site_selected = true;
scrollPosSites = 256;
},function() {
$(this).removeClass("hover");
site_selected = false;
scrollPosSites = 256;
});
// Display the list of EAAs in a dropdown when the form field is
focused on.
$(".activate_eaa_list").focus(function() {
$("#eaa_list_dropdown").slideDown('fast');
}).blur(function() {
$("#eaa_list_dropdown").slideUp('fast');
});
// Display a nice hover colour when the EAAs are focused on.
$("#eaa_list_dropdown").find("li").hover(function() {
$("#eaa_list_dropdown").find(".hover").removeClass("hover");
$(this).addClass("hover");
eaaSelected = true;
    scrollPosEAAs = 256;
},function() {
$(this).removeClass("hover");
eaaSelected = false;
scrollPosEAAs = 256;
});

On Oct 24, 4:40 pm, Jolyon Terwilliger <[EMAIL PROTECTED]> wrote:
> Hi Charles,
>
> I'm not sure exactly how your code is, but it seems like you would
> want to run the code that applies the .hover() function to the li
> items after you pull them in via each ajax request.
>
> On Oct 24, 5:26 am, Charles Sexton <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello!
>
> > I'm using jQuery to build a form dynamically. Here's how it works:
>
> > You are presented with an input box. When you focus on the box a
> > dropdown list appears that you can click on in order to insert the
> > chosen option into the input box, or you can use the keyboard arrow
> > buttons to select your choice.
> > When you move to the next input box the page makes a call via AJAX to
> > grab information for the input box based on the previous selection.
>
> > The problem is that the ".hover()" function doesn't seem to work with
> > the information that has been pulled into the document using jQuery
> > (it works fine with the first list). The items that are pulled in are
> > all list items ({name}). Using keystrokes works on the items,
> > just not mouse gestures. Would this be a jQuery bug or is there
> > something I can do?
>
> > Many thanks,
>
> > Charles- Hide quoted text -
>
> - Show quoted text -



[jQuery] Hovering over jQuery retrieved HTML

2007-10-24 Thread Charles Sexton

Hello!

I'm using jQuery to build a form dynamically. Here's how it works:

You are presented with an input box. When you focus on the box a
dropdown list appears that you can click on in order to insert the
chosen option into the input box, or you can use the keyboard arrow
buttons to select your choice.
When you move to the next input box the page makes a call via AJAX to
grab information for the input box based on the previous selection.

The problem is that the ".hover()" function doesn't seem to work with
the information that has been pulled into the document using jQuery
(it works fine with the first list). The items that are pulled in are
all list items ({name}). Using keystrokes works on the items,
just not mouse gestures. Would this be a jQuery bug or is there
something I can do?

Many thanks,

Charles



[jQuery] Focusfields

2007-09-25 Thread Charles Sheehan-Miles

Hello all,

I'm new to jquery, so forgive me if I'm asking questions which have
been asked a thousand times.  I've searched through the list archives
and not had much luck with this one.

I'm using the focusfields plugin, which I found here:

http://www.texotela.co.uk/code/jquery/focusfields/

It works great on Firefox, Camino, etc., and the demo works fine on
IE.  But in my test setup, I get this error:

'this.parentNode.borderCss.off' is null or not an object

Error comes up as soon as the page loads.

I'm using jQuery 1.2 on my server, which is the one difference I found
from the demo page (which seems to be calling jquery-1.1.2.pack.js).
If this possibly a version difference, and the newer version doesn't
deal as well with IE?

Hope someone has some ideas,

Charles



[jQuery] Focusfields

2007-09-25 Thread Charles Sheehan-Miles

Hello all,

I'm new to jquery, so forgive me if I'm asking questions which have  
been asked a thousand times.  I've searched through the list archives  
and not had much luck with this one.

I'm using the focusfields plugin, which I found here:

http://www.texotela.co.uk/code/jquery/focusfields/

It works great on Firefox, Camino, etc., and the demo works fine on  
IE.  But in my test setup, I get this error:

'this.parentNode.borderCss.off' is null or not an object

Error comes up as soon as the page loads.

I'm using jQuery 1.2 on my server, which is the one difference I  
found from the demo page (which seems to be calling  
jquery-1.1.2.pack.js).  If this possibly a version difference, and  
the newer version doesn't deal as well with IE?

Hope someone has some ideas,

Charles


[jQuery] Re: jQuery capture images from webcam

2007-07-25 Thread Charles Capps

Web Specialist wrote:
> jQuery haves plugins available for web images capture? I'm developing a
> ColdFusion application to store visitors personal data including your
> photo. What I'm looking for:
> 
> - webcam captures visitor photo via iframe(or another solution) in our
> form application;
> - users(application) can cut that photo via jQuery;
> - after all that image is saved in our server;
> 
> Is it a dream? ;-)
> 
> Cheers
> 
> 


To the best of my knowledge, the only way to capture anything webcamish
from a user is to use Flash.  There aren't any plugins that I know of
that Javascript could interface with to accomplish that goal.


[jQuery] Re: append reformting the content i send it

2007-07-10 Thread Charles Capps

Mike Alsup wrote:
> 
>> Hmm... I might be off base on that upper case thing, I'm not sure.
>> (Anyone
>> who knows, feel free to jump in.)
> 
> No, I think you've got that right.  It just depends how you're viewing
> the DOM.  Firebug will show you lowercase elements, IE dev toolbar
> will always show uppercase.  Sounds like just a display issue for
> whatever tool is being used.  jQuery will create a tbody element for
> you if you append (prepend,etc) a table w/o one, but it's lowercase.
> 
> Mike

Beyond this, there are also major differences in how different browsers
represent innerHTML.  Compare the same innerHTML in Firefox, IE, and
Opera, and you'll see three entirely different strings.  Firefox
generally looks similar to whatever was inserted with sanitization
(double quoted attributes and whatnot), IE tends to be massively
uppercase with unquoted attributes, and Opera is just wacky.





[jQuery] Re: IE Caching AJAX calls

2007-05-17 Thread Charles Capps

When in doubt, whack'em all.

Pragma: no-cache
Cache-control: no-cache, must-revalidate
Expires: (some date in the past in the proper format)


Jimmy Glass wrote:
> Hi Jeff,
> That is what I was thinking... But, I'm not sure of the key/value pair
> to add to the response. Do you know?
> 
> Jimmy G
> 
> 
> 
> 
> 
> *From*: "Jeffrey Kretz" <[EMAIL PROTECTED]>
> *Sent*: Thursday, May 17, 2007 11:19 AM
> *To*: jquery-en@googlegroups.com
> *Subject*: [jQuery] Re: IE Caching AJAX calls
> 
> 
> If you can control the server-side pages that are supplying your ajax
> requests, you can also add response headers to the http response telling the
> browser to not to cache it.
> 
> JK
> 
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Gordon
> Sent: Thursday, May 17, 2007 11:07 AM
> To: jQuery (English)
> Subject: [jQuery] Re: IE Caching AJAX calls
> 
> 
> One trick I found was to simply do:
> 
> $.get (myUrl + '?uid=' + math.random(), myAjaxCallBack)
> 
> On May 17, 5:49 pm, "Jimmy Glass" wrote:
>> Hi...
>> So... I just noticed that IE is caching my AJAX requests (I code to
> Firefox, and then test IE later). I expect some of you have run into this
> problem before.
>>
>> Of course, I can create unique request string by appending a "Request
> Identifer" to each URL. I found this great UUID javascript that works
> nicely.
>>
>> However, It is a pain to have to do this to every request. Is the
> something in JQuery that addresses this? Are there any other solutions, like
> changing header values in a request /response that I am over looking?
>>
>> Any thoughts would be greatly appreciated
>>
>> Sincerely,
>> Jimmy G
> 
> 
> 
> 



[jQuery] Re: Interface Sortable Boxes

2007-05-07 Thread Charles Capps

Bil Corry wrote:
> 
> Is there another plug-in that does the same thing as Interface's
> Sortable Boxes demo, but without crashing Safari?
> 
> 

While it's not much help to your search, an updated nightly Webkit no
longer crashes on the example page.



[jQuery] Re: datePicker v2 beta

2007-04-25 Thread Charles Capps

Kelvin Luck wrote:
> Hi,
> 
> Thanks for the feedback. Re. the invalid dates, I'm not sure where this 
> should be corrected. You don't want to stop someone from selecting 31 in the 
> date dropdown just because the month dropdown is on Feb (as they may be 
> selecting 31 and then planning to change the month dropdown).
> 
> I've made a bit of a compromise which is that when you open the date picker 
> it will now automatically update the selects to the date selected in the date 
> picker. Does this make sense to you? Obviously you would want to validate the 
> dates in the selects before submitting if this was a real form but this tweak 
> means that at least the date you see in the date picker is synchronised with 
> the date on the selects..
> 
> Cheers,
> 
> Kelvin :)

That makes enough sense to work around the senselessness of a date that
doesn't exist to begin with, IMO.  Thanks!

-- 
CC



[jQuery] Re: datePicker v2 beta

2007-04-24 Thread Charles Capps

Kelvin Luck wrote:
> Hi,
> 
> I'd like to announce the beta release of v2 of my datePicker plugin for 
> jQuery. This release is a complete rewrite which makes the date picker 
> considerably more powerful and flexible than it previously was. Check out the 
> temporary project page:
> 
> http://kelvinluck.com/assets/jquery/datePicker/v2/demo/
> 
> Note, this is currently in beta and may be a little rough around the edges 
> but I'd love to get some feedback. I've tested in FF2, IE6 and Opera 9 but it 
> would be good to know if it works in other browsers (particulaly Safari). 
> Plus any other feedback on extra stuff you'd like adding or bugs you discover,
> 
> Cheers,
> 
> Kelvin :)

Works flawlessly in Safari 2.0.4 (build 419.3), comparing functionality
and rendering with Firefox 2.

However, there is a possible bug in this demo:
http://kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerIntoSelects.html

It lets you select "invalid" dates, such as Feb 31 with the dropdowns.
 While the resulting date in the calendar is sane (Mar 3 in the non-leap
year that I tested with), there might be some validation code missing
somewhere.


[jQuery] Re: 15 second delay with IE

2007-04-04 Thread Charles Capps

I am unable to duplicate any IE weirdness, using IE6 and IE7.


mike wrote:
> Hi Jeffrey,
> 
> An example is at:
> http://www.green-welly.co.uk/rcc/basic-example.html
> 
> It takes me 15 seconds to load this page in IE, Firefox & Opera are
> immediate.  Well puzzled.
> 
> Thanks, mike
>