[jQuery] Re: .html() and ampersand

2008-12-18 Thread real

use .text() if you're looking to return a string of text only rather
than html. And by value of a label, you do mean labelwhat goes in
here/label right?

On Dec 18, 5:41 pm, graphic...@googlemail.com
graphic...@googlemail.com wrote:
 Hi,

 I use the .html() function to get the value of a label, but when it
 contains an ampersand ()  it is converted to  amp ;

 How can I prevent that or is there another way of getting the value of
 the label ?

 Thanks


[jQuery] Re: syntax for $(response).$('a').each()

2008-12-18 Thread real

Try this instead:

$('a', data).click(function(){
var href = $(this).attr('href');
[etc...]
});

When using $('a', data).attr('onclick', 'javascript:your code goes
here'); the 2nd parameter should be a string, as if you were doing a
href=# onclick=javascript:your code goes herefoo/a

On Dec 18, 12:55 pm, Namotco namo...@gmail.com wrote:
 Here is what I'm trying to do:
                         $(#MTB).load(url + #content, function(data) {
                                    $(a, data).attr(onclick,function (arr) 
 {
                                         var href=this.attr('href');
                                         if (href.match('string') ) {return  
 getMTB
 (this.href); return false;; } else { return 'alert(this.href); return
 false;' ;}
                                   });
                         });
 It doesn't seem to work though


[jQuery] Re: Code Editors

2008-09-11 Thread real

Aptana might be a consideration. Or there's also the Eclipse IDE with
the Aptana plugin.

On Sep 11, 10:41 am, Andiih [EMAIL PROTECTED] wrote:
 I always feel VS in all its incarnations is a bit clunky, and a bit
 heavy.  Its a necessary evil for dot net development, but I'd prefer
 to avoid it where possible. I know many love it, but its just not
 'me'.

 I'm building a clean development machine and I don't yet need to
 install VS, so I wont. I've just checked: the (MSDN) download for VS
 2008 Pro is 3.8GB! Says it all really.

 On Sep 11, 2:36 pm, MorningZ [EMAIL PROTECTED] wrote:

  So if you are used to MS stuff, why not Web Developer Express or
  Studio 2008?   both support intellisense with jQuery


[jQuery] Re: Convert MooTools to jQuery

2008-09-05 Thread real

$(function(){
$('.Boite').each(function(){
$(this).find('div').hide();
});

$('.Boite a').click(function(){
$(this).parent().find('div').toggle();
});
})

On Sep 5, 1:38 pm, israel.hayes [EMAIL PROTECTED] wrote:
 Hi,

 I was using MooTools before and I'm kinda new to jQuery, I'd like to
 know how you would modify this to use it in jQuery, Thanks,

 - Israel

 window.addEvent('domready', function()
 {
     var Boites = $$('.Boite');

     Boites.each(function(Boite)
     {
         var Lien = Boite.getElement('a');

         Lien.addEvent('click', function()
         {
             var Boite = Lien.getParent();
             var Contenu = Boite.getElement('div');

             if(Contenu.style.display == none)
             {
                 Contenu.style.display = block;
             }
             else
             {
                 Contenu.style.display = none;
             }
         });

         var Contenu = Boite.getElement('div');
         Contenu.style.display = 'none';
     });

 });


[jQuery] Re: Autorefreshing DIV

2008-09-05 Thread real

setInterval(function(){
$('#my_refreshable_div').load('some_folder/my_div_content.html');
}, 2000)

On Sep 1, 7:02 am, Sir Rawlins [EMAIL PROTECTED]
wrote:
 Good morning all,

 I have a requirement to automaticly refresh a DIV with some content
 from another URL every couple of seconds and was hoping to get your
 opinions on how this is best handled.

 For instance, I have a div which looks like this:

 div id=my_refreshable_div
 /div

 I dont need a full blown AJAX call as I simply want to fill this div
 with the content from a remote file every few seconds, for instance. /
 some_folder/my_div_content.html.

 I've currently got a working Spry (sorry for swearing) example on the
 page but as part of our move over to jQuery (woohoo) I'm looking for
 your thoughts on how best to achieve this!?!

 Many thanks for your thoughts guys,

 Robert


[jQuery] Re: Removing the html jQuery adds in effects

2008-07-03 Thread real

This is what you would want to do:
$(#gallery li:first).before(litesting/
li).hide().slideDown(slow)

On Jul 3, 11:51 am, pek [EMAIL PROTECTED] wrote:
 I have a small problem when dealing with effects. Warning: Noob
 question ahead.

 Currently I have a list of items
 ul id=gallery
   litest/li
   litest2/li
 /ul

 alert($(#gallery li:first).html()) will correctly echo test.
 If I want to add a new element before that with a slideDown effect, I
 use this line:
 $(#gallery li:first).before().html(litesting/
 li).hide().slideDown(slow)

 Although this correctly adds the line and smoothly slides it down, now
 the list is like this:
 ul id=gallery
   li style=display: block;
 litesting/li
   /li
   litest/li
   litest2/li
 /ul

 The extra li with the style is added by jQuery for the effect. This
 isn't a problem until you want again to add something before the first
 element.
 Now alert($(#gallery li:first).html()) incorrectly (well, correctly,
 but not what I want anyway) returns litesting/li instead of
 testing which means that if I try to do the same effect with the
 same code it will not add before, rather, it will replace it and do
 the effect again.

 Any help?

 Thank you in advance.
 Panagiotis


[jQuery] Re: extending objects with jquery

2008-05-06 Thread real

You might want to check this out:
http://ejohn.org/blog/simple-javascript-inheritance/

On May 6, 11:13 am, Javier Martinez [EMAIL PROTECTED] wrote:
 I'm moving from mootools to jquery and trying to port my UI framework
 to jquery.
 Some of my widgets are extending from another widget. For example a
 datagrid and a dataview objects extends from view object
 (because both uses same methods from view).
 With Mootools I have something like this

 Class View()

 Class DataGrid ({
 extends: View

 })

 Class DataView({
 extends: View

 })

 What is the equivalent on jQuery?

 Thanks!


[jQuery] Re: Way to designate links as form submitters?

2008-05-05 Thread real

If you're trying to replicate the functionality of a submit button,
then the link would only submit the form it's contained in. A regular
submit button wouldn't submit any form (unless I'm mistaken) if it's
not within the form tags anyway. So why not something like this?

$(document).ready(function(){
$('a.formlink').click(function(){
$(this).parents('form').submit();
return false;
});
});

This way you can have multiple forms on the page if needed.

On May 2, 12:48 pm, Rick Faircloth [EMAIL PROTECTED] wrote:
 Well... the original plan was to use the pagination links
 on the page to submit the form fields.   That way a user
 could change the search options and just continue clicking the
 pagination links instead of submitting the new options.

 However, I believe this might be confusing, so I created a
 Click here link after making option choices to make it clear
 what the user is supposed to do.

 And yes, Karl, there's only one form on the page...

 This solution (it's different than the example submit link I
 tossed out earlier) is working fine:

 $(document).ready(function() {
 $('.submitLink').click(function() {
 $('form').get(0).submit();
 return false;
 });
 });

 With a text link like this:

 pUncheck the boxes above to remove those property types from the listings 
 and click
 a class=submitLink href=cfoutput#listlast(cgi.script_name,
 '/')#?pagenumber=#pagenumber#/cfoutputhere/a./p

 So, up to this point, everything's working well.

 You can see it in action at:http://c21ar.wsm-dev.com/cfm/browse-properties.cfm

 Let me know if you have any trouble with it if you decide to check it out.

 Thanks for all the help!

 Rick

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of hj
  Sent: Friday, May 02, 2008 11:45 AM
  To: jQuery (English)
  Subject: [jQuery] Re: Way to designate links as form submitters?

   Anyway to do that?

   Have certain links, say with an id of link,
   to be programmed to submit a form when clicked?

  Why not mark up the links as buttons, or input type=submit elements,
  and then
  just use CSS to style them appropriately?

  --

  hj


[jQuery] Re: parent of this

2007-12-17 Thread real

And $('.class a') wouldn't find the anchor tag. It would be $
('a.class')

On Dec 17, 12:41 pm, Lourenço [EMAIL PROTECTED] wrote:
 Hello,

 i need get the this's parent div, something like this:

 div
   a href=# class=closeClose/a
 /div

 and in code..
 $(.class a).click(function(){
   $(this  div).slideUp(); //here

 });

 that way many buttons will work with no ids and with the same code!
 how can i do it?
 i don't wanna use ids...

 sorry my bad english
 thanks!


[jQuery] Re: Ajax with Jquery : Load or $.get

2007-12-17 Thread real

Well to my knowledge, the reasons I generally use $.load() is to
inject HTML dynamically into my page. Since you can pass variables in
the $.load() function you're able to do it that way, but I'm not sure
if that's the intended use of that method.

$.get('newsletter_db.php', {email: email, type: type, nom: nom},
function(responseText){
// do whatever you want on a successful ajax request
});

What problems were you encountering with the $.get() and $.post()
methods? There's also the $.ajax() method which you could use as such:

$.ajax({
url: 'newsletter_db.php',
type: 'GET',// or 'POST'
data: {email: email, type: type, nom: nom},
success: function(responseText){
// on success callback
},
error: function(responseText){
// on error callback
}
});

On Dec 16, 10:33 am, Brandnew [EMAIL PROTECTED] wrote:
 Hello,

 i'm fairly new to the Jquery process, but i'm enjoying a lot learning
 how to use it. Lately, I made my first attempt at using a kind of
 Ajax page for the Newsletter of my website.

 I couldn't use things like $.get or $.post because I surely don't use
 them well since they don't work for me (still lot to learn). But
 instead I used load. And so far it has been quite effective even if
 I know I'm probably not on the right path.

 So my question is : is it real Ajax if I use Load like this :

 var nom = $('.nom').val();
 var email = $('.email').val();
 var type = $('select').val();

 $('#html').load(newsletter_db.php, {email:email, type:type,
 nom:nom},
  function(responseText){
 $('#html').show(1000);
   });

 Basically on the newsletter_db.php file, it takes the variables
 ($_REQUEST['']) and complete action with the database following what's
 been written on the form. If it's a subscription or a unsubscription,
 what's the name and the email (checked by a preg_replace). And then
 there are message if the database connection failed, or if the email
 was not written correctly, or if one input was blank...

 I used that technique because when I try with $.get or $.post, I
 cannot make a message appear on the screen where the user is. I mean,
 I could make an alert('Success') for example. But I want the message
 to come from the other page which is called. That's why I use load.

 Am I totally screwing up ?

 And if so, could you give me some clue on how to make that with $.get
 or $.post ?

 Thank you !


[jQuery] Re: Interface iAutoscroller and DOCTYPE

2007-09-18 Thread real

hm is no one else experiencing this problem?

On Sep 17, 6:02 pm, real [EMAIL PROTECTED] wrote:
 Hi,

 I've tested the iAutoscroller from the Interface plugin and it doesn't
 seem to work when a DOCTYPE is declared, in either Firefox or IE. Is
 there something I'm missing, or is there a workaround? I basically
 want the site to autoscroll down or up as something is dragged and
 sorted.

 Thanks in advance.



[jQuery] Interface iAutoscroller and DOCTYPE

2007-09-17 Thread real

Hi,

I've tested the iAutoscroller from the Interface plugin and it doesn't
seem to work when a DOCTYPE is declared, in either Firefox or IE. Is
there something I'm missing, or is there a workaround? I basically
want the site to autoscroll down or up as something is dragged and
sorted.

Thanks in advance.



[jQuery] IE6 Rendering Problem with SlideDown?

2007-09-11 Thread real

Hi,

I've been building a site, and we have modules that can be collapsed/
expanded. This works fine in Firefox, but of course IE6 has some
issues with this.

I'll explain the problem, and you can check it yourself at
http://artist.fabricmg.net (password is music123). Scroll down to the
modules (with dark grey header) and click on the little icon to the
very right of the dark grey bar, that icon should either expand or
collapse the module.

The problem is, in IE6, when the module is collapsed, and you expand
it, for some reason the width of the module shrinks by a few pixels.
These modules are also sortable, and once moved, the module returns to
its original size. I did an alert on the width of the module, before
and after expansion, and it remains the same, which leads me to
believe its a rendering issue.

Would anyone know of a way to fix this or a workaround?

Again, the URL is http://artist.fabricmg.net (password is music123)

Thanks in advance.

Alex



[jQuery] Re: jQuery OOP Question - Need Suggestions

2007-06-14 Thread real

Thanks. Would there be a benefit for me to use prototype instead of
privileged members? And if so, how do people generally get around the
lack of self as a reference to the object?

On Jun 13, 6:54 pm, Sean Catchpole [EMAIL PROTECTED] wrote:
 Hi,

 Your code looks just fine, I'll just hit on a few stylization points.
 In general I'm a minimalist and I believe that having whitespace at the
 appropriate point in code will allow for easier understanding/reading of the
 code. Often people hit enter and tab at every possible occaision, but this
 is not always useful.

 I notice you do this a few times:  .append('h2/h2')
   .find('h2')
   .text(settings.title)
   .end()

 Instead try this:
   .append($('h2'+settings.title+'/h2'))

   .click(
   function(){
   callback();
   self.close();
   }
   );

 I perfer to do this:
   .click(function(){
   callback();
   self.close();
   });

   case 'url':
   $self.find('div.content').load(oContent);
   break;
   case 'html':
   $self.find('div.content').html(oContent);
   break;

 I would condense this into one line each, then it is easier to see trends
   case 'url':  $self.find('div.content').load(oContent); break;
   case 'html': $self.find('div.content').html(oContent); break;

 As far OOP goes, I think you are doing just fine.

 ~Sean



[jQuery] jQuery OOP Question - Need Suggestions

2007-06-13 Thread real

Hi all,

I found a few threads related to jQuery OOP, but since I'm pretty new
to OOP maybe I just was not understanding a few things.

I pasted some code below, and it's my attempt at OOP, but is there a
way to make this code more jQuery like? Or just better in general? All
suggestions are welcome.

Thanks.

function jsWindow (opts){
var settings = $.extend(
{
title: 'Window',
width: 400,
dialogClass: 'jsWindow'
},
opts
);

this.width = settings.width;
this.height = settings.height;
this.title = settings.title;

var self = this; // reference to object
var $self; // will be used as reference to jQuery HTML element upon
this.create.window()

this.create = {
window: function(){
$window = $('div/div');

$window
.addClass(settings.dialogClass)
.css( { width: settings.width} )
.append('h2/h2')
.find('h2')
.text(settings.title)
.end()
.append('div/div')
.find('div')
.addClass('content')
.end()
.append('div/div')
.find('div')
.eq(1)
.addClass('buttons');

$self = $window;
return $window;
},

button: function (buttonType, buttonText, callback){
callback = (typeof(callback) == 'undefined') ? 
function(){} :
callback;
var $button = $('button/button');

$button
.addClass(buttonType + 'Class')
.text(buttonText)
.click(
function(){
callback();
self.close();
}
);

return $button;
}
}

this.add = {
button: function(btn){
$self.find('div.buttons').append(btn);
}
}

this.set = {
title: function(string){
self.title = string;
},

width: function(integer){
self.width = integer;
$self.css({ width: integer });
},

height: function(integer){
self.height = integer;
$self.css({ height: integer });
},

position: function(oTop, oLeft){
$self.css(
{
position: 'absolute',
top: oTop,
left: oLeft
}
);
},

content: function(oContent, oType){
switch (oType){
case 'url':

$self.find('div.content').load(oContent);
break;

case 'html':

$self.find('div.content').html(oContent);
break;

default:

$self.find('div.content').html(oContent);
break;
}
}
}

this.center = function(){
var viewWidth = $(window).width();
var viewHeight = $(window).height();
oLeft = (cleanInt(viewWidth, 'px') / 2) - (cleanInt(self.width,
'px') / 2);
oTop = (cleanInt(viewHeight, 'px') / 2) - 
(cleanInt($self.height(),
'px') / 2);

self.set.position(oTop, oLeft);
}

this.open = function (fx, speed){
if (typeof(fx) == 'undefined') {
$self.appendTo('body').show();
}
else {
$self.appendTo('body').hide().animate(fx, speed);
}
}

this.close = function(fx, speed){
if (typeof(fx) == 'undefined') {
$self.remove();
}
   

[jQuery] Can a list be sortable and droppable at the same time (with Interface)?

2007-05-03 Thread real

Hi,

I have an unordered list that needs to be sortable, but also
droppable. I'm using the Interface plugin, but whenever I make one UL
both droppable and sortable, it doesn't function properly.

Either that, or is there a way to have the same functionality as the
onDrop callback (for droppables), but on a sortable? The onStop
callback (for sortables) doesn't cut it.

Thanks.



[jQuery] Re: Can a list be sortable and droppable at the same time (with Interface)?

2007-05-03 Thread real

Or actually, would there just be a way for the following
functionality: an item from a sortable is dragged into another list
(that's also sortable), but when the dragging stops, instead of the
item being *moved* to the new list, can it be copied there instead?

On May 3, 3:01 pm, real [EMAIL PROTECTED] wrote:
 Hi,

 I have an unordered list that needs to be sortable, but also
 droppable. I'm using the Interface plugin, but whenever I make one UL
 both droppable and sortable, it doesn't function properly.

 Either that, or is there a way to have the same functionality as the
 onDrop callback (for droppables), but on a sortable? The onStop
 callback (for sortables) doesn't cut it.

 Thanks.



[jQuery] How do you write custom callback functions in jQuery?

2007-04-11 Thread real

I'm pretty sure this is possible, but I couldn't seem to put my finger
on how to do it properly. What I'm looking to do is create either
functions or jQuery methods with a custom callback functionality, that
would work in the same way as the built-in callbacks for fadeIn,
slideDown, etc.

For example:

$.fn.testFunc = function(param, callback){
//do something that delays, like a fadeIn (just using the fadeIn as an
example, but since the fadeIn already has callback functionality, it's
not an ideal choice, but I hope you get my point)
callback();
}

So that this could be called like so, and the callback would execute
after the rest of the code was finished

$(obj).testFunc(param, function(){
//do some more stuff
}

I've tried tinkering with the $.fn.queue method but I was unable to
get it to work for me.

Any ideas?

Thanks.



[jQuery] Re: How do you write custom callback functions in jQuery?

2007-04-11 Thread real

Not quite, I don't necessarily want a delay in a set amount of time, I
was looking to execute the second function after the first one has
completed. For animations and AJAX calls, jQuery already handles that,
but I wanted to integrate a callback functionality in my own custom
methods.

Thanks for the help though! =)

On Apr 11, 2:27 pm, Klaus Hartl [EMAIL PROTECTED] wrote:
 Jörn Zaefferer schrieb:

  $.fn.delayHide(time, callbackArgument) {
  var self = this;
  setTimeout(function() {
  callbackArgument.call(self);
  }, time);
  }
  $(input).delay(3000, function() {
  this.hide();
  });

  That should delay hiding an element by three seconds, using a callback.
  Does that example help?

 I think you wanted to write this:

 jQuery.fn.delay = function(time, callback) {
  var self = this;
  setTimeout(function() {
  callback.call(self);
  }, time);

 };

 Nice! Where do useful micro plugins go?

 -- Klaus



[jQuery] Re: combing classes ?

2007-04-11 Thread real

Yes, I'm pretty sure you can.

On Apr 11, 2:36 pm, Frans H. [EMAIL PROTECTED] wrote:
 Jquery is really amazing! I am so glad I was introduced to it.

 Is there a way to combine features from multiple plugins ? I'd  love a
 sortable, scrollable table with key navigation :)

 I'd really love to use all that jquery coolness you guys have created!



[jQuery] Re: Determine if a table cell is visible or not?

2007-04-11 Thread real

This should work for you:

if ( $('td').is(':visible') ) { // the rest of your code }

On Apr 11, 2:32 pm, Matt Kruse [EMAIL PROTECTED] wrote:
 I'd like to find out if a table cell is actually visible or not. Is
 there a method in any plugin that will do this work for me?

 The complexity is that any element in the cell's parent chain may be
 display:none, in which case it would be hidden. But the cell's
 corresponding col or colgroup tag may also be display:none which
 would cause it to be hidden as well, and those tags are not parents of
 the cell itself. Checking the cell's current 'display' value will of
 course get me nowhere.

 I've begun writing logic to handle this case, but it would be great if
 someone has already done it!

 Matt Kruse



[jQuery] Re: Determine if a table cell is visible or not?

2007-04-11 Thread real

Oh... oops sorry about that! lol

On Apr 11, 2:48 pm, Klaus Hartl [EMAIL PROTECTED] wrote:
 real schrieb:

  This should work for you:

  if ( $('td').is(':visible') ) { // the rest of your code }

 That won't work (for any element) if display: none has been declared
 for an ancestor element. Or in this special case the col which the td
 belongs to (which is not exactly an ancestor).

 This is a known issue, but solving it is too expensive (it would require
 to traverse up and check visibility for each element until a hidden one
 is found), thus it was never added to jQuery.

 -- Klaus