[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery
The problem with your fix is that the event target for the mouseup is not the same as the mousedown. You can resolve that by saving the clicked checkbox in a var, and because of event order the change has to be made on 'click' rather than mouseup. http://jsbin.com/asizu/edit Sorry for the bugs, this was written rather quickly, I hope it works now :) On Apr 11, 11:30 am, Lwangaman donjohn.f...@gmail.com wrote: Ok I tried to touch up the code a little to fix that, here's my example: http://jsbin.com/iyubi/edit Now, with a single click, the value on mouseup is reversed to keep it as it was with mousedown. But, when you do a drag, the mouseup of the last checkbox is not canceled or reversed... I suppose it would be enough to cancel $(this)'s mouseup, but how would you refer to $(this) from within the $boxes.bind('mouseover')? On 11 Apr, 16:07, Lwangaman donjohn.f...@gmail.com wrote: Hmm, just noticed one problem though... A single click on a checkbox is supposed to work too, but with this code as soon as you mouseup the value goes back the other way... You have to drag off in order to keep the value in there... On 11 Apr, 06:21, Ricardo ricardob...@gmail.com wrote: I think you already got the .dc namespacing thing, so: the mousedown is not being bound to the checkbox, but to the container element (the table, or in my example below, the UL). When you click a checkbox the mousedown event will bubble up to the container and fire this handler. As I expected my code had some flaws a few typing errors, see it fixed/ working here: http://jsbin.com/edabo/edit I added the ability to specify a selector for the checkboxes, that way you can skip the ones you don't want. In case it's not provided all checkboxes are used by default. cheers, - ricardo On Apr 10, 8:17 pm, Lwangaman donjohn.f...@gmail.com wrote: Ok first of all thanks for taking interest! Then, I've tried going through your code and applying it, and I have a few questions: -- Besides the mouseover.dc that I didn't get either... -- I'm supposing that $boxes would be a variable where all the checkboxes that are applicable have been stored previously? Yet, if you build it as a plugin you have no way of defining which checkboxes are to comprised (unless this functionality is built into the plugin using data passed through parameters, I suppose). -- Then I don't quite understand what the mousedown is being bound to. In my example (which was not built as a plugin, but I suppose a plugin or defined function would be even better because it's much more flexible and anyone can download it and use it), the mousedown was being bound to all the cells that had checkboxes in them, and I was determining that through the class I had given them mychkbox (because I didn't want some of the checkboxes included, since they do not have an active state; the table has names, addresses, emails, and those that don't have an email have an inactive checkbox). I was also trying to follow cross-browser.com's way of listening to the mousedown on the cell containing the checkbox rather than on the checkbox itself, making the whole click-drag thing a lot more user-friendly. On 10 Apr, 20:36, jay jay.ab...@gmail.com wrote: Just curious.. What is the difference between mouseover.dc and mouseover? On Apr 10, 1:44 pm, Ricardo ricardob...@gmail.com wrote: This (untested) is how I envision the code for that: $.fn.dragCheck = function(){ //this == the current jQuery element return this.each(function(){ //this == current element in the loop (table etc) $(this).bind('mousedown', function(e){ //don't do anything if you didn't click a checkbox if ( !$(e.target).is(':checkbox') ) return true; //get the clicked checkbox state isChecked = e.target.checked; //apply it to all other checkboxes on mouseover $boxes.bind('mouseover.dc', function(){ this.checked = isChecked; }); }).bind('mouseup', function(e){ //cancel the mouseover action $boxes.unbind('mouseover.dc'); }); }; $('#table1').dragCheck(); cheers, - ricardo On 9 abr, 17:15, Lwangaman donjohn.f...@gmail.com wrote: Ok I resolved the cannot assign to a function result problem by putting the value assignment into a function(){}: 48 $(td.mychkbox).each( 49 function(){ 50 $(this).bind( 51 mouseover, 52 function(){ 53 if (gCheckedValue != null){ 54 var eccomi = this; 55 var eccoti = $(eccomi).find(input:checkbox); 56* function(){$(eccoti).attr(checked) =
[jQuery] Re: jQuery SL - jQuery Silverlight Plugin Feedback
The Vividas technology seems great, it can play HD fullscreen with zero hiccups, and has great quality using low bandwith: http://vividas.com/ On Apr 11, 5:42 am, Jordon Bedwell jor...@envygeeks.com wrote: You confuse the Silverlight project completely. It's not just a player. It's really actually truly a server. Kind of like Flash Media Server but way more advanced, they are 10 different leagues apart. Check outhttp://www.streamflashhd.com/which is an Adobe/Akamai project demonstrating using Silverlight with Flash. I don't know who in their right mind would even consider using Java for Video. If you are going to do that, you might as well download the HD video to your computer... Silverlight is really a server, it's capabilities include downgrading live streams based on your bandwidth. It's used by some of the biggest companies, and word around is Hulu will soon switch to a Flash/Silverlight setup. Example: If you are at 10MBPS when you first tap the video and then all of a sudden you drop to 1MBPS bandwidth, it will downgrade the video, and upgrade the video if you gain more available bandwidth, creating a constant smooth stream. Flash alone does not have this capability because it is downloading the video just as if you were downloading it yourself. Flash with silverlight though, it gains this ability. -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Thomas Creutz Sent: Saturday, April 11, 2009 3:11 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: jQuery SL - jQuery Silverlight Plugin Feedback Thomas Creutz schrieb: Jordon Bedwell schrieb: I suggest you check outhttp://www.smoothhd.com/before you start dogging Silverlight. Learn a little about things before you dogg them please. haha, its not possible, I use Linux ... and Moonlight is not the right solution. because: I have Moonlight installed and also cannot open the side - why ppl not use java or flash? Its OFFICIAL supported on Win, Mac and Linux too. Moonlight is not official, so u will have every time problems! Thomas
[jQuery] Re: Problems using JRC corner or curvycorner
you could try this plugin http://gist.github.com/77516 works for me On Mar 26, 9:18 pm, banacan banaca...@gmail.com wrote: Nicola, Thanks for the link. Unfortunately CornerZ won't work on this project because the parent div background is a gradient and the background color must be specified in the call. I'm sure it will work great for a different project. I'm back to square one on this issue, whether to use strictly CSS. Thanks for your help. On Mar 26, 3:43 pm, Nikola nik.cod...@gmail.com wrote: Here you go.. it hasn't been refactored for IE8 yet though. http://labs.parkerfox.co.uk/cornerz/ On Mar 26, 2:54 pm, banacan banaca...@gmail.com wrote: Nicola, I'm not familiar with CornerZ. I searched the plugin repository and found nothing. Can you supply a link? Thanks. On Mar 26, 1:59 pm, Nikola nik.cod...@gmail.com wrote: I've found JRC and the Bullet Proof CornerZ PlugIns to be foolproof... except in IE8 thus far. On Mar 26, 11:44 am, banacan banaca...@gmail.com wrote: I'm creating a page with many divs that I would like to have rounded corners, and several problems keep coming up. When using JRC for rounding, not all elements will round even though they have the correct class. Reloading the page will, after several attempts, create the rounded corners, though sometimes some elements will never round. This is even more problematic when the div has a border; I can see the rounded bg but the border is still square. Again, after repeated reloadings (3 or 4 times) it will usually work, though in some browsers it might not. Also, when using a gradient background on the parent div, the corner does not pick up the underlying color. When using curvycorner, the underlying color does come through, but again the div is not always rounded on the first load. It too needs refreshing multiple times before displaying correctly. Also, with curvycorners IE (6 anyway) does not produce rounded corners at all. So my questions are: Is this a common failing of these scripts? Is having the CSS in an external file the problem? Could these problems be caused by my local testing server? MAC OSX10.4.9, Apache 1.3.1, PHP 5.2, MySQL 5.0 Is a traditional CSS approach more reliable - though not easier? I don't want to spend much more time on this and I was hoping to hear from others whether or not they have experienced similar problems. If this is just not reliable, I need to take a different approach. TIA- Hide quoted text - - Show quoted text -
[jQuery] Re: jQuery Form Validation
Just remove the required-rule. All other methods include a check to make a field optional when empty. Jörn On Sat, Apr 11, 2009 at 7:16 PM, NobitaNobi79 frankcheun...@gmail.com wrote: Hi, I am new to jQuery. I follow the example on http://docs.jquery.com/Plugins/Validation/Methods/email to add rules to a form validator. When I modified the rules to email: true (required: false), the script seems to stall there, no error message nor a check. Can someone tell me if I am doing anything wrong here? What I want is to let the validation pass if the optional fields are valid when they are filled or they are left out empty. I can, of course add an extra script like... if (($(#field).val() == ) || $(#field).valid()) { optionalValid = true; } But it seems very redundant considering the rules: { field: {email: true, required: false}}, with or without the default required: false option. Thanks
[jQuery] Re: Validation plugin remote problem
You need to echo true for a valid value. Jörn On Sun, Apr 12, 2009 at 1:02 AM, Victorr victor.ry...@gmail.com wrote: I'm using CakePHP, jQuery and the validation plugin. I'm having some problems. I'm trying to check if a email is already in use but I can't seem to get it too work. I'm just trying to get a error message to see that it works but I can't seem to get it right. Javascript: $(document).ready(function() { $(#UserIndexForm).validate({ rules: { data[User][email]: { required: true, email: true, remote: / }, data[User][passwrd]: { required: true, minlength: 5 }, }, messages: { data[User][email]: { required: Du måste ange en e-post adress., email: Du måste ange en giltig e-post adress., remote: E-post adressen du angav är upptagen. }, data[User][passwrd]: { required: Du måste ange ett lösenord., minlength: Ditt lösenord måste vara minst 5 tecken. } } }); }); And the controller: if ($this-RequestHandler-isAjax() !empty($_REQUEST['data'] ['User']['email'])) { $valid = 'false'; echo $valid; } Thanks!
[jQuery] Re: JSON , PHP, MySQL, and jQuery
Nope. There are no associative arrays in JS, and you can't have an object without property names (that would be the case in your example). The way he posted is correct, an array of objects. On Apr 12, 2:23 am, Jean jnascime...@gmail.com wrote: [ {'name': 'John', 'lastName': 'Doe','age':'25', 'height': '170', 'weight': '120'}, {'name': 'Jane', 'lastName': 'Doe','age':'26', 'height': '175', 'weight': '121'}, {'name': 'Jack', 'lastName': 'Doe','age':'27', 'height': '180', 'weight': '122'} ] i think is {' [name': 'John', 'lastName': 'Doe','age':'25', 'height': '170', 'weight': '120'], ['name': 'Jane', 'lastName': 'Doe','age':'26', 'height': '175', 'weight': '121'], ['name': 'Jack', 'lastName': 'Doe','age':'27', 'height': '180', 'weight': '122']} isnt? On Wed, Apr 8, 2009 at 11:21 PM, Renato Untalan phis...@gmail.com wrote: I'm having trouble parsing JSON in Javascript. The response i'm getting from PHP when making a request is: [ {'name': 'John', 'lastName': 'Doe','age':'25', 'height': '170', 'weight': '120'}, {'name': 'Jane', 'lastName': 'Doe','age':'26', 'height': '175', 'weight': '121'}, {'name': 'Jack', 'lastName': 'Doe','age':'27', 'height': '180', 'weight': '122'} ] How would I go about parsing this in Javascript? Am I not encoding it correctly on the PHP Side? Here's my JAVASCRIPT: $.get(includes/functions_inside.php, {function : getAppList}, function(data, textStatus){ alert( data[0] ); } ); Here's my PHP: $AppListQuery = $insideDB-customQuery($query); $rows = array(); while($r = mysql_fetch_assoc($AppListQuery)) { $rows[] = $r; } print json_encode($rows); Thanks in advance! -- []´s Jean a.k.a Suissa Tecnólogo em Análise de Sistemas - UTF-PRwww.tudopg.com.brwww.tudocuritiba.com.brwww.tudocacascavel.com.brwww.tudofoz.com.brwww.tudopuava.com.br
[jQuery] Re: jquery toggle class, I needed to switch class....
didnt you forget jQuery.fn.switchClass=function ??? On Mar 23, 7:47 pm, Eric Garside gars...@gmail.com wrote: Or: jQuery.fn.switchClass( a, b ){ var t = this.hasClass(a); this.addClass( t ? b : a ).removeClass( t ? a : b ); } On Mar 23, 12:35 pm, T.J. Crowder t...@crowdersoftware.com wrote: Hi, You're creating (or worse, overwriting) global variables 'remove' and 'add' there (because you haven't given the 'var' keyword, and thus are creating implicit globals[1]). The temporaries don't really buy you anything anyway, perhaps simply: jQuery.fn.switchClass = function(class1,class2) { if (this.hasClass(class1)) { this.removeClass(class1).addClass(class2); } else { this.removeClass(class2).addClass(class1); } }; [1]http://blog.niftysnippets.org/2008/03/horror-of-implicit-globals.html FWIW, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Mar 23, 1:33 pm, Artistan artis...@gmail.com wrote: /// /// Switch Between Classes /// /// jQuery.fn.switchClass = function(class1,class2) { if(this.hasClass(class1)){ remove = class1; add = class2; } else { remove = class2; add = class1; } this.removeClass(remove); this.addClass(add); }; Hope this helps someone out.
[jQuery] ajax post data json - php receives only post data, no json
hi... i have a normal email form, where the user can send an email with some data... at first i send it with normal post (no dataType in jquery)... but it was difficult to handle the returning messages from php, e.g. validation messages or ok messages... therefor i tried dataType json... like the code below... now i con better handle the returning messages, but i wonder why i still get single post data in php ($_POST['name'], $_POST['email)'] etc and NO nested json!... is there something wrong with my data format? in firebug i also see only single post data... no json format when posting best regards m, cologne ## $.ajax({ type: POST, url: /mail/process.php5, data: {name:name, email:email, message:message, n:textmail, i:pic}, dataType: json, success: function(res) { if(res.result == 1) { $('#dialog').html(pWE SEND THE EMAIL + res.message + /p); } else if(res.result == 0) { $('#dialog').html(pERROR + res.message + /p); }
[jQuery] Re: ajax post data json - php receives only post data, no json
learn to make a simple ajax query before playing with jquery, to use json data is completely senseless here On Apr 12, 1:32 pm, mcologne blueameri...@web.de wrote: hi... i have a normal email form, where the user can send an email with some data... at first i send it with normal post (no dataType in jquery)... but it was difficult to handle the returning messages from php, e.g. validation messages or ok messages... therefor i tried dataType json... like the code below... now i con better handle the returning messages, but i wonder why i still get single post data in php ($_POST['name'], $_POST['email)'] etc and NO nested json!... is there something wrong with my data format? in firebug i also see only single post data... no json format when posting best regards m, cologne ## $.ajax({ type: POST, url: /mail/process.php5, data: {name:name, email:email, message:message, n:textmail, i:pic}, dataType: json, success: function(res) { if(res.result == 1) { $('#dialog').html(pWE SEND THE EMAIL + res.message + /p); } else if(res.result == 0) { $('#dialog').html(pERROR + res.message + /p); }
[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery
Ok that works better, I just changed clicked.checked = !isChecked to clicked.checked = isChecked: http://jsbin.com/idihi/edit On 12 Apr, 08:11, Ricardo ricardob...@gmail.com wrote: The problem with your fix is that the event target for the mouseup is not the same as the mousedown. You can resolve that by saving the clicked checkbox in a var, and because of event order the change has to be made on 'click' rather than mouseup. http://jsbin.com/asizu/edit Sorry for the bugs, this was written rather quickly, I hope it works now :) On Apr 11, 11:30 am, Lwangaman donjohn.f...@gmail.com wrote: Ok I tried to touch up the code a little to fix that, here's my example: http://jsbin.com/iyubi/edit Now, with a single click, the value on mouseup is reversed to keep it as it was with mousedown. But, when you do a drag, the mouseup of the last checkbox is not canceled or reversed... I suppose it would be enough to cancel $(this)'s mouseup, but how would you refer to $(this) from within the $boxes.bind('mouseover')? On 11 Apr, 16:07, Lwangaman donjohn.f...@gmail.com wrote: Hmm, just noticed one problem though... A single click on a checkbox is supposed to work too, but with this code as soon as you mouseup the value goes back the other way... You have to drag off in order to keep the value in there... On 11 Apr, 06:21, Ricardo ricardob...@gmail.com wrote: I think you already got the .dc namespacing thing, so: the mousedown is not being bound to the checkbox, but to the container element (the table, or in my example below, the UL). When you click a checkbox the mousedown event will bubble up to the container and fire this handler. As I expected my code had some flaws a few typing errors, see it fixed/ working here: http://jsbin.com/edabo/edit I added the ability to specify a selector for the checkboxes, that way you can skip the ones you don't want. In case it's not provided all checkboxes are used by default. cheers, - ricardo On Apr 10, 8:17 pm, Lwangaman donjohn.f...@gmail.com wrote: Ok first of all thanks for taking interest! Then, I've tried going through your code and applying it, and I have a few questions: -- Besides the mouseover.dc that I didn't get either... -- I'm supposing that $boxes would be a variable where all the checkboxes that are applicable have been stored previously? Yet, if you build it as a plugin you have no way of defining which checkboxes are to comprised (unless this functionality is built into the plugin using data passed through parameters, I suppose). -- Then I don't quite understand what the mousedown is being bound to. In my example (which was not built as a plugin, but I suppose a plugin or defined function would be even better because it's much more flexible and anyone can download it and use it), the mousedown was being bound to all the cells that had checkboxes in them, and I was determining that through the class I had given them mychkbox (because I didn't want some of the checkboxes included, since they do not have an active state; the table has names, addresses, emails, and those that don't have an email have an inactive checkbox). I was also trying to follow cross-browser.com's way of listening to the mousedown on the cell containing the checkbox rather than on the checkbox itself, making the whole click-drag thing a lot more user-friendly. On 10 Apr, 20:36, jay jay.ab...@gmail.com wrote: Just curious.. What is the difference between mouseover.dc and mouseover? On Apr 10, 1:44 pm, Ricardo ricardob...@gmail.com wrote: This (untested) is how I envision the code for that: $.fn.dragCheck = function(){ //this == the current jQuery element return this.each(function(){ //this == current element in the loop (table etc) $(this).bind('mousedown', function(e){ //don't do anything if you didn't click a checkbox if ( !$(e.target).is(':checkbox') ) return true; //get the clicked checkbox state isChecked = e.target.checked; //apply it to all other checkboxes on mouseover $boxes.bind('mouseover.dc', function(){ this.checked = isChecked; }); }).bind('mouseup', function(e){ //cancel the mouseover action $boxes.unbind('mouseover.dc'); }); }; $('#table1').dragCheck(); cheers, - ricardo On 9 abr, 17:15, Lwangaman donjohn.f...@gmail.com wrote: Ok I resolved the cannot assign to a function result problem by putting the value assignment into a function(){}: 48 $(td.mychkbox).each( 49 function(){ 50 $(this).bind(
[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery
@Ricardo Do you think it could be useful to add this to the jquery plugins at plugins.jquery.com? I'd say it could be put under your name because you did all the big work! On 12 Apr, 14:35, Lwangaman donjohn.f...@gmail.com wrote: Ok that works better, I just changed clicked.checked = !isChecked to clicked.checked = isChecked: http://jsbin.com/idihi/edit On 12 Apr, 08:11, Ricardo ricardob...@gmail.com wrote: The problem with your fix is that the event target for the mouseup is not the same as the mousedown. You can resolve that by saving the clicked checkbox in a var, and because of event order the change has to be made on 'click' rather than mouseup. http://jsbin.com/asizu/edit Sorry for the bugs, this was written rather quickly, I hope it works now :) On Apr 11, 11:30 am, Lwangaman donjohn.f...@gmail.com wrote: Ok I tried to touch up the code a little to fix that, here's my example: http://jsbin.com/iyubi/edit Now, with a single click, the value on mouseup is reversed to keep it as it was with mousedown. But, when you do a drag, the mouseup of the last checkbox is not canceled or reversed... I suppose it would be enough to cancel $(this)'s mouseup, but how would you refer to $(this) from within the $boxes.bind('mouseover')? On 11 Apr, 16:07, Lwangaman donjohn.f...@gmail.com wrote: Hmm, just noticed one problem though... A single click on a checkbox is supposed to work too, but with this code as soon as you mouseup the value goes back the other way... You have to drag off in order to keep the value in there... On 11 Apr, 06:21, Ricardo ricardob...@gmail.com wrote: I think you already got the .dc namespacing thing, so: the mousedown is not being bound to the checkbox, but to the container element (the table, or in my example below, the UL). When you click a checkbox the mousedown event will bubble up to the container and fire this handler. As I expected my code had some flaws a few typing errors, see it fixed/ working here: http://jsbin.com/edabo/edit I added the ability to specify a selector for the checkboxes, that way you can skip the ones you don't want. In case it's not provided all checkboxes are used by default. cheers, - ricardo On Apr 10, 8:17 pm, Lwangaman donjohn.f...@gmail.com wrote: Ok first of all thanks for taking interest! Then, I've tried going through your code and applying it, and I have a few questions: -- Besides the mouseover.dc that I didn't get either... -- I'm supposing that $boxes would be a variable where all the checkboxes that are applicable have been stored previously? Yet, if you build it as a plugin you have no way of defining which checkboxes are to comprised (unless this functionality is built into the plugin using data passed through parameters, I suppose). -- Then I don't quite understand what the mousedown is being bound to. In my example (which was not built as a plugin, but I suppose a plugin or defined function would be even better because it's much more flexible and anyone can download it and use it), the mousedown was being bound to all the cells that had checkboxes in them, and I was determining that through the class I had given them mychkbox (because I didn't want some of the checkboxes included, since they do not have an active state; the table has names, addresses, emails, and those that don't have an email have an inactive checkbox). I was also trying to follow cross-browser.com's way of listening to the mousedown on the cell containing the checkbox rather than on the checkbox itself, making the whole click-drag thing a lot more user-friendly. On 10 Apr, 20:36, jay jay.ab...@gmail.com wrote: Just curious.. What is the difference between mouseover.dc and mouseover? On Apr 10, 1:44 pm, Ricardo ricardob...@gmail.com wrote: This (untested) is how I envision the code for that: $.fn.dragCheck = function(){ //this == the current jQuery element return this.each(function(){ //this == current element in the loop (table etc) $(this).bind('mousedown', function(e){ //don't do anything if you didn't click a checkbox if ( !$(e.target).is(':checkbox') ) return true; //get the clicked checkbox state isChecked = e.target.checked; //apply it to all other checkboxes on mouseover $boxes.bind('mouseover.dc', function(){ this.checked = isChecked; }); }).bind('mouseup', function(e){ //cancel the mouseover action $boxes.unbind('mouseover.dc'); }); };
[jQuery] Re: ajax post data json - php receives only post data, no json
@donb: thanks... i thought it was in both directions... On 12 Apr., 16:46, donb falconwatc...@comcast.net wrote: $_post sends the data which 'arrives' at your PHP page as $_POST array elements. That's the nature of an HTTP post action. By indicating a 'json' datatype, the data your script returns will be expected to be in JSON form. On Apr 12, 7:32 am, mcologne blueameri...@web.de wrote: hi... i have a normal email form, where the user can send an email with some data... at first i send it with normal post (no dataType in jquery)... but it was difficult to handle the returning messages from php, e.g. validation messages or ok messages... therefor i tried dataType json... like the code below... now i con better handle the returning messages, but i wonder why i still get single post data in php ($_POST['name'], $_POST['email)'] etc and NO nested json!... is there something wrong with my data format? in firebug i also see only single post data... no json format when posting best regards m, cologne ## $.ajax({ type: POST, url: /mail/process.php5, data: {name:name, email:email, message:message, n:textmail, i:pic}, dataType: json, success: function(res) { if(res.result == 1) { $('#dialog').html(pWE SEND THE EMAIL + res.message + /p); } else if(res.result == 0) { $('#dialog').html(pERROR + res.message + /p); }
[jQuery] Re: How do I set the value of a form element?
Thanks! That did it! Can you take a look at where I ultimately need to go with this? This page... http://www.eastexhaust.com/inventory_.php ...has two forms. First one generates a part number via ajax. The next form sends us the part number with name, phone, email, etc. I'm trying to get the same part number that appears via ajax, to populate the value of the id=partnum element in the second form. I can get it to work in FF by taking the ajax code: if (http_request.status == 200) { //alert(http_request.responseText); result = http_request.responseText; document.getElementById('myspan').innerHTML = result; ...and adding this: document.getElementById('partnum').value= result; You can see that version here: http://www.eastexhaust.com/inventory_1.php Unfortunately, that does not work in IE. Hence, I'm hoping jQuery can solve the problem. Or that someone can tell how to get the non-jQuery version that works in FF to work in IE. Thanks again for your help so far, and for any further help you can give me! On Apr 12, 9:52 am, victorg vr.gerrit...@gmail.com wrote: script language=text/javascript -- script type=text/ javascript On Apr 12, 3:29 pm, webguy262 webguy...@yahoo.com wrote: I'm sorry for being so thick, but I'm stuck. Please, can someone view the source of this page... http://www.eastexhaust.com/jquerytest.html ...and tell me why it is not setting the value of the form element? ricardobeat wrote: $('#myspan').text( $('#partnum').val() ); http://docs.jquery.com/Attributes On Mar 29, 6:07 pm, webguy262 webguy...@yahoo.com wrote: I have two forms on a page (www.eastexhaust.com/inventory.php). One uses ajax to generate a part number by selecting values from a series of selection boxes. The other form emails the part number so we can reply with a quote. Everything works fine in FFox, but does not work in IE. Therefore, I have had to make things harder by asking the user to copy and paste their part number into the email form instead of having it entered there automatically. To display the part number to the user, I'm using this in the JS... document.getElementById('myspan').innerHTML = result; ...and this in the html... To get the variable in the email form, I'm using this in the JS... document.getElementById('partnum').value= result; ...and this in the html... input type=text name=partnum id=partnum readonly As I said, this works everywhere but not in IE. How can I use Jquery to make it work across the board? Thanks! -- View this message in context:http://www.nabble.com/ajax-problem-in-IE-tp22772776s27240p22772776.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context:http://www.nabble.com/ajax-problem-in-IE-tp22772776s27240p23011076.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: How do I set the value of a form element?
script language=text/javascript -- script type=text/ javascript On Apr 12, 3:29 pm, webguy262 webguy...@yahoo.com wrote: I'm sorry for being so thick, but I'm stuck. Please, can someone view the source of this page... http://www.eastexhaust.com/jquerytest.html ...and tell me why it is not setting the value of the form element? ricardobeat wrote: $('#myspan').text( $('#partnum').val() ); http://docs.jquery.com/Attributes On Mar 29, 6:07 pm, webguy262 webguy...@yahoo.com wrote: I have two forms on a page (www.eastexhaust.com/inventory.php). One uses ajax to generate a part number by selecting values from a series of selection boxes. The other form emails the part number so we can reply with a quote. Everything works fine in FFox, but does not work in IE. Therefore, I have had to make things harder by asking the user to copy and paste their part number into the email form instead of having it entered there automatically. To display the part number to the user, I'm using this in the JS... document.getElementById('myspan').innerHTML = result; ...and this in the html... To get the variable in the email form, I'm using this in the JS... document.getElementById('partnum').value= result; ...and this in the html... input type=text name=partnum id=partnum readonly As I said, this works everywhere but not in IE. How can I use Jquery to make it work across the board? Thanks! -- View this message in context:http://www.nabble.com/ajax-problem-in-IE-tp22772776s27240p22772776.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context:http://www.nabble.com/ajax-problem-in-IE-tp22772776s27240p23011076.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Block UI and Safari search plug-in
hi everyone, I'm using Block UI plugin and I'm happy with it. I discovered Safari search plug-in and wanted to give it a try, while it works well in Safari, in Firefox and IE the search box is really messed up; I tried to hunt down the problem and it is somewhat related not to css per se but in Block UI plugin. I tried to look at the code but I cannot find any valid point where it messes up a text input field. Does anybody that uses Block UI with http://docs.jquery.com/Plugins/SafariSearch experienced issues? This is how the box looks like: http://yfrog.com/07testut thanks.
[jQuery] Re: ajax post data json - php receives only post data, no json
$_post sends the data which 'arrives' at your PHP page as $_POST array elements. That's the nature of an HTTP post action. By indicating a 'json' datatype, the data your script returns will be expected to be in JSON form. On Apr 12, 7:32 am, mcologne blueameri...@web.de wrote: hi... i have a normal email form, where the user can send an email with some data... at first i send it with normal post (no dataType in jquery)... but it was difficult to handle the returning messages from php, e.g. validation messages or ok messages... therefor i tried dataType json... like the code below... now i con better handle the returning messages, but i wonder why i still get single post data in php ($_POST['name'], $_POST['email)'] etc and NO nested json!... is there something wrong with my data format? in firebug i also see only single post data... no json format when posting best regards m, cologne ## $.ajax({ type: POST, url: /mail/process.php5, data: {name:name, email:email, message:message, n:textmail, i:pic}, dataType: json, success: function(res) { if(res.result == 1) { $('#dialog').html(pWE SEND THE EMAIL + res.message + /p); } else if(res.result == 0) { $('#dialog').html(pERROR + res.message + /p); }
[jQuery] How do I set the value of a form element?
I'm sorry for being so thick, but I'm stuck. Please, can someone view the source of this page... http://www.eastexhaust.com/jquerytest.html ...and tell me why it is not setting the value of the form element? ricardobeat wrote: $('#myspan').text( $('#partnum').val() ); http://docs.jquery.com/Attributes On Mar 29, 6:07 pm, webguy262 webguy...@yahoo.com wrote: I have two forms on a page (www.eastexhaust.com/inventory.php). One uses ajax to generate a part number by selecting values from a series of selection boxes. The other form emails the part number so we can reply with a quote. Everything works fine in FFox, but does not work in IE. Therefore, I have had to make things harder by asking the user to copy and paste their part number into the email form instead of having it entered there automatically. To display the part number to the user, I'm using this in the JS... document.getElementById('myspan').innerHTML = result; ...and this in the html... To get the variable in the email form, I'm using this in the JS... document.getElementById('partnum').value= result; ...and this in the html... input type=text name=partnum id=partnum readonly As I said, this works everywhere but not in IE. How can I use Jquery to make it work across the board? Thanks! -- View this message in context:http://www.nabble.com/ajax-problem-in-IE-tp22772776s27240p22772776.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/ajax-problem-in-IE-tp22772776s27240p23011076.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: replacing entire html node having jquery trigger document.ready again for new content
So far I've been able to get this piece of code to do almost all of what I want - only problem is that the browser is able to track this in it's cache, so back/forward buttons iterate through each new document.write() call: var html = data.responseText.match(/html?[\s\S]+\/html/im); document.open(); document.write(html); document.close(); Doing it this way actually triggers the document.ready event so everything runs just fine (except the caching issue). I've tried doing: document.documentElement.innerHTML = html; instead of the open/write/close calls, but it doesn't trigger the document.ready event (if I recall), and also it causes some odd css formatting problems (css attached to the html node seems to not get applied or something).
[jQuery] Re: Validation plugin remote problem
Ok. But what do i need too echo to get a false value and an error message? thanks! On 12 Apr, 10:37, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You need to echo true for a valid value. Jörn On Sun, Apr 12, 2009 at 1:02 AM, Victorr victor.ry...@gmail.com wrote: I'm using CakePHP, jQuery and the validation plugin. I'm having some problems. I'm trying to check if a email is already in use but I can't seem to get it too work. I'm just trying to get a error message to see that it works but I can't seem to get it right. Javascript: $(document).ready(function() { $(#UserIndexForm).validate({ rules: { data[User][email]: { required: true, email: true, remote: / }, data[User][passwrd]: { required: true, minlength: 5 }, }, messages: { data[User][email]: { required: Du måste ange en e-post adress., email: Du måste ange en giltig e-post adress., remote: E-post adressen du angav är upptagen. }, data[User][passwrd]: { required: Du måste ange ett lösenord., minlength: Ditt lösenord måste vara minst 5 tecken. } } }); }); And the controller: if ($this-RequestHandler-isAjax() !empty($_REQUEST['data'] ['User']['email'])) { $valid = 'false'; echo $valid; } Thanks!
[jQuery] Re: Block UI and Safari search plug-in
whops, actually the page is http://www.levsys.co.uk/products/jquery-safari-search-1.0/ currently I'm still investigating, not quite 100% sure itìs block ui behaving like this. Il giorno 12/apr/09, alle ore 17:25, Claudio Poli ha scritto: hi everyone, I'm using Block UI plugin and I'm happy with it. I discovered Safari search plug-in and wanted to give it a try, while it works well in Safari, in Firefox and IE the search box is really messed up; I tried to hunt down the problem and it is somewhat related not to css per se but in Block UI plugin. I tried to look at the code but I cannot find any valid point where it messes up a text input field. Does anybody that uses Block UI with http://docs.jquery.com/Plugins/SafariSearch experienced issues? This is how the box looks like: http://yfrog.com/07testut thanks.
[jQuery] Re: Block UI and Safari search plug-in
I found the problem, markup was missing a class. On 12 Apr, 17:40, Claudio Poli masterk...@gmail.com wrote: whops, actually the page ishttp://www.levsys.co.uk/products/jquery-safari-search-1.0/ currently I'm still investigating, not quite 100% sure itìs block ui behaving like this. Il giorno 12/apr/09, alle ore 17:25, Claudio Poli ha scritto: hi everyone, I'm using Block UI plugin and I'm happy with it. I discovered Safari search plug-in and wanted to give it a try, while it works well in Safari, in Firefox and IE the search box is really messed up; I tried to hunt down the problem and it is somewhat related not to css per se but in Block UI plugin. I tried to look at the code but I cannot find any valid point where it messes up a text input field. Does anybody that uses Block UI withhttp://docs.jquery.com/Plugins/SafariSearch experienced issues? This is how the box looks like:http://yfrog.com/07testut thanks.
[jQuery] Re: replacing entire html node having jquery trigger document.ready again for new content
Is the document not ready after innerHTML is set? I'd imagine there would be circumstances where different browsers would behave differently with styling of certain DOM elements, but I imagine you could special case those situations. On Apr 12, 10:31 am, e.sand elisand@gmail.com wrote: So far I've been able to get this piece of code to do almost all of what I want - only problem is that the browser is able to track this in it's cache, so back/forward buttons iterate through each new document.write() call: var html = data.responseText.match(/html?[\s\S]+\/html/im); document.open(); document.write(html); document.close(); Doing it this way actually triggers the document.ready event so everything runs just fine (except the caching issue). I've tried doing: document.documentElement.innerHTML = html; instead of the open/write/close calls, but it doesn't trigger the document.ready event (if I recall), and also it causes some odd css formatting problems (css attached to the html node seems to not get applied or something).
[jQuery] Re: addClass (et al) malfunctioning in IE7
It would be nice if you can post your code here so we can easily debug it. Cheers, --- Randell http://randell.ph/geeky/
[jQuery] Superfish v1.4.8 – jQuery menu
Hi, I having some problems with the css inside the superfish as I want the menu to change the text and selected menu to another color when rollover it. May I know which part of the code that needs to be changed?
[jQuery] Slider Range
Hi, Im trying the Slider range and set min and max values. How do I set on load the max value to be 'No Limit' like www.century21.com ? Thanks, Lstr
[jQuery] jQuery on a generic registration form
Hi guys, I recently wrote a simple script for registration forms. It includes AJAX checking if a username and/or email already exists, checking if passwords match, loading and reloading of captcha. I know the code can still be improved with respect to the use of jQuery and other programming practices (including documentation). I'd like to know what you think. Is it good enough? Which part would you take off? What would you like to add to it? And yeah, feel free to bash me if you have to. =D http://randell.ph/geeky/2009/04/10/using-jquery-on-a-generic-registration-form/ Cheers! --- Randell http://randell.ph/
[jQuery] Re: sidebar menu
You can try googling 'suckerfish'. It might be the answer you're looking for. Cheers, --- Randell http://randell.ph/geeky/
[jQuery] [validate]Submit button needing to be clicked twice.
I'm using the validation plugin from http://bassistance.de/jquery- plugins/jquery-plugin-validation/ and I'm encountering a problem when submitting CORRECT data. When the data being inputted is all correct, I end up having to click the submit button TWICE before the data is sent to the server. What could be causing this? Here's my code: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; headmeta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /title Post a classified advertisement for Apartment in the Philippines. /title link href=/Styles/pilipinoy.css rel=stylesheet type=text/ css / script src=/Scripts/MicrosoftAjax.debug.js type=text/ javascript/script script src=/Scripts/MicrosoftMvcAjax.debug.js type=text/ javascript/script script src=/Scripts/jquery-1.3.2.min.js type=text/ javascript/script script src=/Scripts/scroller.js type=text/javascript/ script style type=text/css div.flash { width: 375px; margin: 10px 5px; border-color: #D9E4FF; -moz-border-radius-topleft : 5px; -webkit-border-top-left-radius : 5px; -moz-border-radius-topright : 5px; -webkit-border-top-right-radius : 5px; -moz-border-radius-bottomleft : 5px; -webkit-border-bottom-left-radius : 5px; -moz-border-radius-bottomright : 5px; -webkit-border-bottom-right-radius : 5px; } #btnSubmit { margin: 0 0 0 155px ; } .progressWrapper { width: 357px; overflow: hidden; } .progressContainer { margin: 5px; padding: 4px; border: solid 1px #E8E8E8; background-color: #F7F7F7; overflow: hidden; } /* Message */ .message { margin: 1em 0; padding: 10px 20px; border: solid 1px #FFDD99; background-color: #CC; overflow: hidden; } /* Error */ .red { border: solid 1px #B5; background-color: #FFEBEB; } /* Current */ .green { border: solid 1px #DDF0DD; background-color: #EBFFEB; } /* Complete */ .blue { border: solid 1px #CEE2F2; background-color: #F0F5FF; } .progressName { font-size: 8pt; font-weight: 700; color: #555; width: 323px; height: 14px; text-align: left; white-space: nowrap; overflow: hidden; } .progressBarInProgress, .progressBarComplete, .progressBarError { font-size: 0; width: 0%; height: 2px; background-color: blue; margin-top: 2px; } .progressBarComplete { width: 100%; background-color: green; visibility: hidden; } .progressBarError { width: 100%; background-color: red; visibility: hidden; } .progressBarStatus { margin-top: 2px; width: 337px; font-size: 7pt; font-family: Arial; text-align: left; white-space: nowrap; } a.progressCancel { font-size: 0; display: block; height: 14px; width: 14px; background-image: url(/Content/images/cancelbutton.gif); background-repeat: no-repeat; background-position: -14px 0px; float: right; } a.progressCancel:hover { background-position: 0px 0px; } .swfupload { vertical-align: top; } /style link href=/Styles/jquery.autocomplete.css rel=stylesheet type=text/css / link href=/Styles/jqmodal.css rel=stylesheet type=text/css / script type=text/javascript src=/Scripts/jquery.autocomplete.js/ script script type=text/javascript src=/Scripts/jquery.metadata.js/ script script type=text/javascript src=/Scripts/ jquery.validate.pack.js/script script type=text/javascript src=/Scripts/tiny_mce/tiny_mce.js/ script script type=text/javascript src=/Scripts/jqModal.js/script script type=text/javascript src=/Scripts/swfupload.js/script script type=text/javascript src=/Other/FileUploadHandler/ script script type=text/javascript tinyMCE.init({ // General options mode: exact, elements: description, theme: advanced, skin: o2k7, plugins: safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups, // Theme options theme_advanced_buttons1: insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,|,insertdate,inserttime,preview,|,fullscreen, theme_advanced_buttons2: tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,advhr,|,print,|,ltr,rtl, theme_advanced_buttons3: cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,|,forecolor,backcolor,
[jQuery] Re: cycle plugin - background color in IE?
Thanks. you save me today.
[jQuery] .each - how to write in my code?
Hello, I am very new to jQuery and don´t know how to write my code for every item. Here is my code for a list with hover functions, I would like for every item to be processed separately. I know about a functio that is written .each, but can´t seem to get it to work. --- script type=text/javascript $(function() { // set opacity to nill on page load $(ul#menu span).css(opacity,0); $(ul#menu li).each(function () { // on mouse over $(ul#menu a).hover(function () { // animate opacity to full $('ul#menu span').stop().animate({ opacity: 1 }, 'slow'); }, // on mouse out function () { // animate opacity to nill $('ul#menu span').stop().animate({ opacity: 0 }, 'slow'); }); }); }); /script --- hope someone has some answers or a book to recommend for a newbie. Regards /adesign
[jQuery] jQuery on a generic registration form
Hi guys, I recently wrote a simple script for registration forms. It basically includes AJAX checking if a username/email exists, checking if the passwords match, loading and reloading of captcha. I feel like there's a lot to improve in this simple script. It would be great if you can bash my code and point out the parts that can be improved. Here it is: http://randell.ph/geeky/2009/04/10/using-jquery-on-a-generic-registration-form/ Cheers, --- Randell http://randell.ph/geeky/
[jQuery] Help, friends!
Hi all I need realize a tag cloud in style, how it done here - 4dle.ru (russian site). I khow it jQuery! Can some give me script to realize it? Please!
[jQuery] Re: .each - how to write in my code?
inside the each you need to reference this or $(this) instead of referencing all of the elements again. On Apr 12, 11:38 am, adesign andersek...@gmail.com wrote: Hello, I am very new to jQuery and don´t know how to write my code for every item. Here is my code for a list with hover functions, I would like for every item to be processed separately. I know about a functio that is written .each, but can´t seem to get it to work. --- script type=text/javascript $(function() { // set opacity to nill on page load $(ul#menu span).css(opacity,0); $(ul#menu li).each(function () { // on mouse over $(ul#menu a).hover(function () { // animate opacity to full $('ul#menu span').stop().animate({ opacity: 1 }, 'slow'); }, // on mouse out function () { // animate opacity to nill $('ul#menu span').stop().animate({ opacity: 0 }, 'slow'); }); }); }); /script --- hope someone has some answers or a book to recommend for a newbie. Regards /adesign
[jQuery] Re: IE8 will not perform Fade animation properly
Here is the HTML: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleUntitled Document/title script type=text/javascript src=javascript/jquery_1-3-2.js/ script script type=text/javascript src=testJava.js/script /head body br / br / span id=FadeThisGuyThis Fades on loadup/span /body /html And here is the JavaScript: $(document).ready(function(){ $(#InputField).focus(); $(#FadeThisGuy).fadeOut(slow); }); It's an incredibly simple test which works fine it Firefox, yet in IE it performs a cut rather than a fade where after the set duration of the effect, the object just disappears. I thought I recall reading somewhere than you had to apply a certain attribute to HTML/CSS in order to activate alpha/opacity in IE but I don't have any concept of how. Thanks again.
[jQuery] Re: How do I set the value of a form element?
I have some more detail on this issue. Again, I'm trying to use jquery to grab the value generated by an an ajax call (done in form 1) and then assign that ajax-generated value to a field in another form (form2). You can see the page and view the source here: http://www.eastexhaust.com/inventory_.php In this verion of the page, I'm using the click function and attaching it to the form 1 submit button. If I hard code the value I want placed in form2, like this... script type=text/javascript $(document).ready(function() { $(#partnumber).click(function(){ $('#partnum').val ( 'this works' ); }); }); /script ... jquery assigns it to the field correctly. But if I code it to assign the ajax-generated value... script type=text/javascript $(document).ready(function() { $(#partnumber).click(function(){ $('#partnum').val ( $('#myspan').text() ); }); }); /script ...it does not work. Could one of the problems be that the ajax-generated value is not available when the jquery code fires? After all, the same submit button is triggering both the ajax request and the jquery function. Any sugeestions? On Apr 12, 10:31 am, webguy...@yahoo.com webguy...@yahoo.com wrote: Thanks! That did it! Can you take a look at where I ultimately need to go with this? This page... http://www.eastexhaust.com/inventory_.php ...has two forms. First one generates a part number via ajax. The next form sends us the part number with name, phone, email, etc. I'm trying to get the same part number that appears via ajax, to populate the value of the id=partnum element in the second form. I can get it to work in FF by taking the ajax code: if (http_request.status == 200) { //alert(http_request.responseText); result = http_request.responseText; document.getElementById('myspan').innerHTML = result; ...and adding this: document.getElementById('partnum').value= result; You can see that version here: http://www.eastexhaust.com/inventory_1.php Unfortunately, that does not work in IE. Hence, I'm hoping jQuery can solve the problem. Or that someone can tell how to get the non-jQuery version that works in FF to work in IE. Thanks again for your help so far, and for any further help you can give me! On Apr 12, 9:52 am, victorg vr.gerrit...@gmail.com wrote: script language=text/javascript -- script type=text/ javascript On Apr 12, 3:29 pm, webguy262 webguy...@yahoo.com wrote: I'm sorry for being so thick, but I'm stuck. Please, can someone view the source of this page... http://www.eastexhaust.com/jquerytest.html ...and tell me why it is not setting the value of the form element? ricardobeat wrote: $('#myspan').text( $('#partnum').val() ); http://docs.jquery.com/Attributes On Mar 29, 6:07 pm, webguy262 webguy...@yahoo.com wrote: I have two forms on a page (www.eastexhaust.com/inventory.php). One uses ajax to generate a part number by selecting values from a series of selection boxes. The other form emails the part number so we can reply with a quote. Everything works fine in FFox, but does not work in IE. Therefore, I have had to make things harder by asking the user to copy and paste their part number into the email form instead of having it entered there automatically. To display the part number to the user, I'm using this in the JS... document.getElementById('myspan').innerHTML = result; ...and this in the html... To get the variable in the email form, I'm using this in the JS... document.getElementById('partnum').value= result; ...and this in the html... input type=text name=partnum id=partnum readonly As I said, this works everywhere but not in IE. How can I use Jquery to make it work across the board? Thanks! -- View this message in context:http://www.nabble.com/ajax-problem-in-IE-tp22772776s27240p22772776.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context:http://www.nabble.com/ajax-problem-in-IE-tp22772776s27240p23011076.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Help, friends!
Why don't you just have a look at the script at that site? On Sat, Apr 11, 2009 at 7:13 PM, rusllangashik online...@gmail.com wrote: Hi all I need realize a tag cloud in style, how it done here - 4dle.ru (russian site). I khow it jQuery! Can some give me script to realize it? Please!
[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery
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 could be put under your name because you did all the big work! On 12 Apr, 14:35, Lwangaman donjohn.f...@gmail.com wrote: Ok that works better, I just changed clicked.checked = !isChecked to clicked.checked = isChecked: http://jsbin.com/idihi/edit On 12 Apr, 08:11, Ricardo ricardob...@gmail.com wrote: The problem with your fix is that the event target for the mouseup is not the same as the mousedown. You can resolve that by saving the clicked checkbox in a var, and because of event order the change has to be made on 'click' rather than mouseup. http://jsbin.com/asizu/edit Sorry for the bugs, this was written rather quickly, I hope it works now :) On Apr 11, 11:30 am, Lwangaman donjohn.f...@gmail.com wrote: Ok I tried to touch up the code a little to fix that, here's my example: http://jsbin.com/iyubi/edit Now, with a single click, the value on mouseup is reversed to keep it as it was with mousedown. But, when you do a drag, the mouseup of the last checkbox is not canceled or reversed... I suppose it would be enough to cancel $(this)'s mouseup, but how would you refer to $(this) from within the $boxes.bind('mouseover')? On 11 Apr, 16:07, Lwangaman donjohn.f...@gmail.com wrote: Hmm, just noticed one problem though... A single click on a checkbox is supposed to work too, but with this code as soon as you mouseup the value goes back the other way... You have to drag off in order to keep the value in there... On 11 Apr, 06:21, Ricardo ricardob...@gmail.com wrote: I think you already got the .dc namespacing thing, so: the mousedown is not being bound to the checkbox, but to the container element (the table, or in my example below, the UL). When you click a checkbox the mousedown event will bubble up to the container and fire this handler. As I expected my code had some flaws a few typing errors, see it fixed/ working here: http://jsbin.com/edabo/edit I added the ability to specify a selector for the checkboxes, that way you can skip the ones you don't want. In case it's not provided all checkboxes are used by default. cheers, - ricardo On Apr 10, 8:17 pm, Lwangaman donjohn.f...@gmail.com wrote: Ok first of all thanks for taking interest! Then, I've tried going through your code and applying it, and I have a few questions: -- Besides the mouseover.dc that I didn't get either... -- I'm supposing that $boxes would be a variable where all the checkboxes that are applicable have been stored previously? Yet, if you build it as a plugin you have no way of defining which checkboxes are to comprised (unless this functionality is built into the plugin using data passed through parameters, I suppose). -- Then I don't quite understand what the mousedown is being bound to. In my example (which was not built as a plugin, but I suppose a plugin or defined function would be even better because it's much more flexible and anyone can download it and use it), the mousedown was being bound to all the cells that had checkboxes in them, and I was determining that through the class I had given them mychkbox (because I didn't want some of the checkboxes included, since they do not have an active state; the table has names, addresses, emails, and those that don't have an email have an inactive checkbox). I was also trying to follow cross-browser.com's way of listening to the mousedown on the cell containing the checkbox rather than on the checkbox itself, making the whole click-drag thing a lot more user-friendly. On 10 Apr, 20:36, jay jay.ab...@gmail.com wrote: Just curious.. What is the difference between mouseover.dc and mouseover? On Apr 10, 1:44 pm, Ricardo ricardob...@gmail.com wrote: This (untested) is how I envision the code for that: $.fn.dragCheck = function(){ //this == the current jQuery element
[jQuery] Re: jquery toggle class, I needed to switch class....
This is exactly the same as $(selector).toggleClass(a).toggleClass(b) On Mar 23, 2:47 pm, Eric Garside gars...@gmail.com wrote: Or: jQuery.fn.switchClass( a, b ){ var t = this.hasClass(a); this.addClass( t ? b : a ).removeClass( t ? a : b ); } On Mar 23, 12:35 pm, T.J. Crowder t...@crowdersoftware.com wrote: Hi, You're creating (or worse, overwriting) global variables 'remove' and 'add' there (because you haven't given the 'var' keyword, and thus are creating implicit globals[1]). The temporaries don't really buy you anything anyway, perhaps simply: jQuery.fn.switchClass = function(class1,class2) { if (this.hasClass(class1)) { this.removeClass(class1).addClass(class2); } else { this.removeClass(class2).addClass(class1); } }; [1]http://blog.niftysnippets.org/2008/03/horror-of-implicit-globals.html FWIW, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Mar 23, 1:33 pm, Artistan artis...@gmail.com wrote: /// /// Switch Between Classes /// /// jQuery.fn.switchClass = function(class1,class2) { if(this.hasClass(class1)){ remove = class1; add = class2; } else { remove = class2; add = class1; } this.removeClass(remove); this.addClass(add); }; Hope this helps someone out.
[jQuery] Re: How do I set the value of a form element?
Where's the ajax call? Assign the form value in your success callback, after the span has been added to the DOM. Or, just assign the return directly to the form element, if that's all you're sending back. On Sun, Apr 12, 2009 at 12:53 PM, webguy...@yahoo.com webguy...@yahoo.com wrote: I have some more detail on this issue. Again, I'm trying to use jquery to grab the value generated by an an ajax call (done in form 1) and then assign that ajax-generated value to a field in another form (form2). You can see the page and view the source here: http://www.eastexhaust.com/inventory_.php In this verion of the page, I'm using the click function and attaching it to the form 1 submit button. If I hard code the value I want placed in form2, like this... script type=text/javascript $(document).ready(function() { $(#partnumber).click(function(){ $('#partnum').val ( 'this works' ); }); }); /script ... jquery assigns it to the field correctly. But if I code it to assign the ajax-generated value... script type=text/javascript $(document).ready(function() { $(#partnumber).click(function(){ $('#partnum').val ( $('#myspan').text() ); }); }); /script ...it does not work. Could one of the problems be that the ajax-generated value is not available when the jquery code fires? After all, the same submit button is triggering both the ajax request and the jquery function. Any sugeestions? On Apr 12, 10:31 am, webguy...@yahoo.com webguy...@yahoo.com wrote: Thanks! That did it! Can you take a look at where I ultimately need to go with this? This page... http://www.eastexhaust.com/inventory_.php ...has two forms. First one generates a part number via ajax. The next form sends us the part number with name, phone, email, etc. I'm trying to get the same part number that appears via ajax, to populate the value of the id=partnum element in the second form. I can get it to work in FF by taking the ajax code: if (http_request.status == 200) { //alert(http_request.responseText); result = http_request.responseText; document.getElementById('myspan').innerHTML = result; ...and adding this: document.getElementById('partnum').value= result; You can see that version here: http://www.eastexhaust.com/inventory_1.php Unfortunately, that does not work in IE. Hence, I'm hoping jQuery can solve the problem. Or that someone can tell how to get the non-jQuery version that works in FF to work in IE. Thanks again for your help so far, and for any further help you can give me! On Apr 12, 9:52 am, victorg vr.gerrit...@gmail.com wrote: script language=text/javascript -- script type=text/ javascript On Apr 12, 3:29 pm, webguy262 webguy...@yahoo.com wrote: I'm sorry for being so thick, but I'm stuck. Please, can someone view the source of this page... http://www.eastexhaust.com/jquerytest.html ...and tell me why it is not setting the value of the form element? ricardobeat wrote: $('#myspan').text( $('#partnum').val() ); http://docs.jquery.com/Attributes On Mar 29, 6:07 pm, webguy262 webguy...@yahoo.com wrote: I have two forms on a page (www.eastexhaust.com/inventory.php). One uses ajax to generate a part number by selecting values from a series of selection boxes. The other form emails the part number so we can reply with a quote. Everything works fine in FFox, but does not work in IE. Therefore, I have had to make things harder by asking the user to copy and paste their part number into the email form instead of having it entered there automatically. To display the part number to the user, I'm using this in the JS... document.getElementById('myspan').innerHTML = result; ...and this in the html... To get the variable in the email form, I'm using this in the JS... document.getElementById('partnum').value= result; ...and this in the html... input type=text name=partnum id=partnum readonly As I said, this works everywhere but not in IE. How can I use Jquery to make it work across the board? Thanks! -- View this message in context:http://www.nabble.com/ajax-problem-in-IE-tp22772776s27240p22772776.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context:http://www.nabble.com/ajax-problem-in-IE-tp22772776s27240p23011076.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: How do I set the value of a form element?
Brian Sorry, i'm not experienced enough to know exactly what you are recommending. Any chance you could take a look at my page source? Everything is there. This version on this page... http://www.eastexhaust.com/inventory_.php ...attempts to set the value of the part number in the second form by grabbing the text of the span in the first form. I'm using this code... (which triggers when you submit the first form -- the one that gets the part number) script type=text/javascript $(document).ready(function() { $(#partnumber).click(function(){ $('#partnum').val ( $('#myspan').text() ); }); }); /script ...to attempt to do that. If I replace val ( $('#myspan').text() ); with something like val ( $('static text'); it works. So I'm assuming there's a problem getting the #myspan variable. If you want to see how it works without jquery -- in works on FF but not IE -- you can take a look and try it at this page... http://www.eastexhaust.com/inventory_1.php I've been trying to resolve this for 2 weeks so any help would be most appreciated! On Apr 12, 3:15 pm, brian bally.z...@gmail.com wrote: Where's the ajax call? Assign the form value in your success callback, after the span has been added to the DOM. Or, just assign the return directly to the form element, if that's all you're sending back. On Sun, Apr 12, 2009 at 12:53 PM, webguy...@yahoo.com webguy...@yahoo.com wrote: I have some more detail on this issue. Again, I'm trying to use jquery to grab the value generated by an an ajax call (done in form 1) and then assign that ajax-generated value to a field in another form (form2). You can see the page and view the source here: http://www.eastexhaust.com/inventory_.php In this verion of the page, I'm using the click function and attaching it to the form 1 submit button. If I hard code the value I want placed in form2, like this... script type=text/javascript $(document).ready(function() { $(#partnumber).click(function(){ $('#partnum').val ( 'this works' ); }); }); /script ... jquery assigns it to the field correctly. But if I code it to assign the ajax-generated value... script type=text/javascript $(document).ready(function() { $(#partnumber).click(function(){ $('#partnum').val ( $('#myspan').text() ); }); }); /script ...it does not work. Could one of the problems be that the ajax-generated value is not available when the jquery code fires? After all, the same submit button is triggering both the ajax request and the jquery function. Any sugeestions? On Apr 12, 10:31 am, webguy...@yahoo.com webguy...@yahoo.com wrote: Thanks! That did it! Can you take a look at where I ultimately need to go with this? This page... http://www.eastexhaust.com/inventory_.php ...has two forms. First one generates a part number via ajax. The next form sends us the part number with name, phone, email, etc. I'm trying to get the same part number that appears via ajax, to populate the value of the id=partnum element in the second form. I can get it to work in FF by taking the ajax code: if (http_request.status == 200) { //alert(http_request.responseText); result = http_request.responseText; document.getElementById('myspan').innerHTML = result; ...and adding this: document.getElementById('partnum').value= result; You can see that version here: http://www.eastexhaust.com/inventory_1.php Unfortunately, that does not work in IE. Hence, I'm hoping jQuery can solve the problem. Or that someone can tell how to get the non-jQuery version that works in FF to work in IE. Thanks again for your help so far, and for any further help you can give me! On Apr 12, 9:52 am, victorg vr.gerrit...@gmail.com wrote: script language=text/javascript -- script type=text/ javascript On Apr 12, 3:29 pm, webguy262 webguy...@yahoo.com wrote: I'm sorry for being so thick, but I'm stuck. Please, can someone view the source of this page... http://www.eastexhaust.com/jquerytest.html ...and tell me why it is not setting the value of the form element? ricardobeat wrote: $('#myspan').text( $('#partnum').val() ); http://docs.jquery.com/Attributes On Mar 29, 6:07 pm, webguy262 webguy...@yahoo.com wrote: I have two forms on a page (www.eastexhaust.com/inventory.php). One uses ajax to generate a part number by selecting values from a series of selection boxes. The other form emails the part number so we can reply with a quote. Everything works fine in FFox, but does not work in IE. Therefore, I have had to make things harder by asking the user to copy and paste their part number into the email form instead of having it entered there automatically. To display
[jQuery] Re: Fade Pictures In and Out
Sorry to bump, but I would like this finished sooner or later. On Apr 11, 3:48 pm, PF piercefree...@gmail.com wrote: Hey everyone and thanks for all the help. I currently have the photos working in a UL list, but I can't figure out how to set them as the background. Thanks for any help. PFwrote: Hi everyone. I asked awhile ago about fading content in and out, now I am wondering how to fade images in and out. The images will be in the background of the page (css: background-image) so I am not quite sure how I could integrate this. Any help would be appreciated!
[jQuery] Re: jQuery on a generic registration form
What should be added is a better Captcha which is accessible for those who can't see - provide a sound alternative, because otherwise your form won't be accessible at all for the blind. Then it could be also helpful to use label elements for specifying the labels for the fields of the form. Others might also say that you shouldn't use a table for layout, but I won't say it, because if it is OK for you, the visitors probably won't have any problem because of that table. Octavian - Original Message - From: Randell josephrandell.benavi...@gmail.com To: jQuery (English) jquery-en@googlegroups.com Sent: Sunday, April 12, 2009 8:06 AM Subject: [jQuery] jQuery on a generic registration form Hi guys, I recently wrote a simple script for registration forms. It includes AJAX checking if a username and/or email already exists, checking if passwords match, loading and reloading of captcha. I know the code can still be improved with respect to the use of jQuery and other programming practices (including documentation). I'd like to know what you think. Is it good enough? Which part would you take off? What would you like to add to it? And yeah, feel free to bash me if you have to. =D http://randell.ph/geeky/2009/04/10/using-jquery-on-a-generic-registration-form/ Cheers! --- Randell http://randell.ph/
[jQuery] Function Problem
New to jQuery and trying to port a simple Select-Box-Value-Hides/Shows- a-Text-Box script from JS to jQuery. I'm sure this must be something simple, but it's driving me nuts. Note: The following function is just an example for testing. If I define call the Function below without any parms (e.g. explicitly set the #showwhat option:selected inside the function), it works fine. But I have 2 Select Boxes where I need this behavior and would like (if only for the sake of principle) to be able to pass in the Selector and Value. When passing in the Selector as a variable, the following snippet executes only when the document loads, but not when the Selection changes. As mentioned if I explicitly set the #showwhat option:selected inside the function the script executes the alert each time the Select Box value changes. Can anyone identify why this isn't working with the variable? Maybe a syntax problem forming the string with the variable? --- sample $(document).ready(function(){ $(#showwhat).change(onSelectChange(#showwhat)); }); function onSelectChange(test){ var selected = $(test + option:selected); var output = ; alert(selected.text()); if(selected.text() == Tomorrow){ output = You Selected + selected.text(); } $(#output).html(output); };
[jQuery] Custom error function in jQuery Validation plugin?
I am new to jQuery validation plugin (http://docs.jquery.com/Plugins/ Validation). What I am trying to do is to have my own error message DIV with display:none initially. If there is error, I want to run the fadein/fadeout to show that error. The structure of the input/error DIV like this: divinput/input/div divcontext help/div diverror msg/div The way this plugin works is to insert a LABEL right next to the INPUT and this is not what I want. I want to reuse the html code I have in the error msg DIV. I tried to look in errorPlacement but not sure how to use it. Can someone help? Thanks
[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery
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 could be put under your name because you did all the big work! On 12 Apr, 14:35, Lwangaman donjohn.f...@gmail.com wrote: Ok that works better, I just changed clicked.checked = !isChecked to clicked.checked = isChecked: http://jsbin.com/idihi/edit On 12 Apr, 08:11, Ricardo ricardob...@gmail.com wrote: The problem with your fix is that the event target for the mouseup is not the same as the mousedown. You can resolve that by saving the clicked checkbox in a var, and because of event order the change has to be made on 'click' rather than mouseup. http://jsbin.com/asizu/edit Sorry for the bugs, this was written rather quickly, I hope it works now :) On Apr 11, 11:30 am, Lwangaman donjohn.f...@gmail.com wrote: Ok I tried to touch up the code a little to fix that, here's my example: http://jsbin.com/iyubi/edit Now, with a single click, the value on mouseup is reversed to keep it as it was with mousedown. But, when you do a drag, the mouseup of the last checkbox is not canceled or reversed... I suppose it would be enough to cancel $(this)'s mouseup, but how would you refer to $(this) from within the $boxes.bind('mouseover')? On 11 Apr, 16:07, Lwangaman donjohn.f...@gmail.com wrote: Hmm, just noticed one problem though... A single click on a checkbox is supposed to work too, but with this code as soon as you mouseup the value goes back the other way... You have to drag off in order to keep the value in there... On 11 Apr, 06:21, Ricardo ricardob...@gmail.com wrote: I think you already got the .dc namespacing thing, so: the mousedown is not being bound to the checkbox, but to the container element (the table, or in my example below, the UL). When you click a checkbox the mousedown event will bubble up to the container and fire this handler. As I expected my code had some flaws a few typing errors, see it fixed/ working here: http://jsbin.com/edabo/edit I added the ability to specify a selector for the checkboxes, that way you can skip the ones you don't want. In case it's not provided all checkboxes are used by default. cheers, - ricardo On Apr 10, 8:17 pm, Lwangaman donjohn.f...@gmail.com wrote: Ok first of all thanks for taking interest! Then, I've tried going through your code and applying it, and I have a few questions: -- Besides the mouseover.dc that I didn't get either... -- I'm supposing that $boxes would be a variable where all the checkboxes that are applicable have been stored previously? Yet, if you build it as a plugin you have no way of defining which checkboxes are to comprised (unless this functionality is built into the plugin using data passed through parameters, I suppose). -- Then I don't quite understand what the mousedown is being bound to. In my example (which was not built as a plugin, but I suppose a plugin or defined function would be even better because it's much more flexible and anyone can download it and use it), the mousedown was being bound to all the cells that had checkboxes in them, and I was determining that through the class I had given them mychkbox (because I didn't want some of the checkboxes included, since they do not have an active state; the table has names, addresses, emails, and those that don't have an email have an inactive checkbox). I was also trying to follow cross-browser.com's way of listening to the mousedown on the cell containing the checkbox rather than on the checkbox itself, making the whole click-drag thing
[jQuery] Re: Help, friends!
google is your best friend. bye! On Apr 12, 1:13 am, rusllangashik online...@gmail.com wrote: Hi all I need realize a tag cloud in style, how it done here - 4dle.ru (russian site). I khow it jQuery! Can some give me script to realize it? Please!
[jQuery] jQuery Documentation
Hi, Was wondering if there is a specific active group for the jQuery documentation project? I'd love to see a system sort of like php.net that allows users to post relevant code examples. to do this, use this. I have trouble connecting the dots sometimes and those examples can really help. Judging from the traffic here on the list, I'm guessing I'm not alone in this (the trouble connecting the dots part). also, if we see weird stuff in the docs, who do we tell? For instance, searching for form on the site brings up http://docs.jquery.com/Form which, I'm guessing, is a mistake. :) Will
[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery
Hmmm... I tried using dragCheck(false) but it doesn't unbind the events, I had to unbind manually. 2009/4/12 Ricardo ricardob...@gmail.com 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 could be put under your name because you did all the big work! On 12 Apr, 14:35, Lwangaman donjohn.f...@gmail.com wrote: Ok that works better, I just changed clicked.checked = !isChecked to clicked.checked = isChecked: http://jsbin.com/idihi/edit On 12 Apr, 08:11, Ricardo ricardob...@gmail.com wrote: The problem with your fix is that the event target for the mouseup is not the same as the mousedown. You can resolve that by saving the clicked checkbox in a var, and because of event order the change has to be made on 'click' rather than mouseup. http://jsbin.com/asizu/edit Sorry for the bugs, this was written rather quickly, I hope it works now :) On Apr 11, 11:30 am, Lwangaman donjohn.f...@gmail.com wrote: Ok I tried to touch up the code a little to fix that, here's my example: http://jsbin.com/iyubi/edit Now, with a single click, the value on mouseup is reversed to keep it as it was with mousedown. But, when you do a drag, the mouseup of the last checkbox is not canceled or reversed... I suppose it would be enough to cancel $(this)'s mouseup, but how would you refer to $(this) from within the $boxes.bind('mouseover')? On 11 Apr, 16:07, Lwangaman donjohn.f...@gmail.com wrote: Hmm, just noticed one problem though... A single click on a checkbox is supposed to work too, but with this code as soon as you mouseup the value goes back the other way... You have to drag off in order to keep the value in there... On 11 Apr, 06:21, Ricardo ricardob...@gmail.com wrote: I think you already got the .dc namespacing thing, so: the mousedown is not being bound to the checkbox, but to the container element (the table, or in my example below, the UL). When you click a checkbox the mousedown event will bubble up to the container and fire this handler. As I expected my code had some flaws a few typing errors, see it fixed/ working here: http://jsbin.com/edabo/edit I added the ability to specify a selector for the checkboxes, that way you can skip the ones you don't want. In case it's not provided all checkboxes are used by default. cheers, - ricardo On Apr 10, 8:17 pm, Lwangaman donjohn.f...@gmail.com wrote: Ok first of all thanks for taking interest! Then, I've tried going through your code and applying it, and I have a few questions: -- Besides the mouseover.dc that I didn't get either... -- I'm supposing that $boxes would be a variable where all the checkboxes that are applicable have been stored previously? Yet, if you build it as a plugin you have no way of defining which checkboxes are to comprised (unless this functionality is built into the plugin using data passed through parameters, I suppose). -- Then I don't quite understand what the mousedown is being bound to. In my example (which was not built as a plugin, but I suppose a plugin or defined function would be even better because it's much more flexible and anyone can download it and use it), the mousedown was being bound to all the cells that had checkboxes in them, and I was determining that through the class I had given them mychkbox (because I didn't want some of the checkboxes included, since they do not have an active state; the table has names, addresses, emails, and those that don't have an email have an inactive checkbox). I was also trying to follow cross-browser.com's way of listening to the mousedown on the cell containing the checkbox rather than on the checkbox itself, making the whole click-drag thing a lot more user-friendly. On 10 Apr, 20:36, jay jay.ab...@gmail.com wrote: Just curious.. What is the difference between mouseover.dc and mouseover? On Apr 10, 1:44 pm, Ricardo ricardob...@gmail.com wrote:
[jQuery] simple query does not work
i am making this(it does not work) : $(document).ready(function(){ $(div#photolinks img).get(0).css(border,5px solid black;); }); if i do this: $(document).ready(function(){ $(div#photolinks img).css(border,5px solid black;); }); it does work, whats wrong? thanks
[jQuery] Re: simple query does not work
I'm not quite sure what you're trying to do here. The $.get() function is used to submit an HTTP GET request. See: http://docs.jquery.com/Ajax/jQuery.get Are you trying to return the first response? Try using $(div#photolinks img:first). Chuck Harmston http://chuckharmston.com On Sun, Apr 12, 2009 at 5:41 PM, dongle tetri...@gmail.com wrote: i am making this(it does not work) : $(document).ready(function(){ $(div#photolinks img).get(0).css(border,5px solid black;); }); if i do this: $(document).ready(function(){ $(div#photolinks img).css(border,5px solid black;); }); it does work, whats wrong? thanks
[jQuery] Re: simple query does not work
nop, there are too get ; one that acts like the javascript index(i) method: http://docs.jquery.com/Core/get i am referring to that one, :first would not help me here. On Apr 13, 12:57 am, Chuck Harmston cpharms...@gmail.com wrote: I'm not quite sure what you're trying to do here. The $.get() function is used to submit an HTTP GET request. See: http://docs.jquery.com/Ajax/jQuery.get Are you trying to return the first response? Try using $(div#photolinks img:first). Chuck Harmstonhttp://chuckharmston.com On Sun, Apr 12, 2009 at 5:41 PM, dongle tetri...@gmail.com wrote: i am making this(it does not work) : $(document).ready(function(){ $(div#photolinks img).get(0).css(border,5px solid black;); }); if i do this: $(document).ready(function(){ $(div#photolinks img).css(border,5px solid black;); }); it does work, whats wrong? thanks
[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery
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 could be put under your name because you did all the big work! On 12 Apr, 14:35, Lwangaman donjohn.f...@gmail.com wrote: Ok that works better, I just changed clicked.checked = !isChecked to clicked.checked = isChecked: http://jsbin.com/idihi/edit On 12 Apr, 08:11, Ricardo ricardob...@gmail.com wrote: The problem with your fix is that the event target for the mouseup is not the same as the mousedown. You can resolve that by saving the clicked checkbox in a var, and because of event order the change has to be made on 'click' rather than mouseup. http://jsbin.com/asizu/edit Sorry for the bugs, this was written rather quickly, I hope it works now :) On Apr 11, 11:30 am, Lwangaman donjohn.f...@gmail.com wrote: Ok I tried to touch up the code a little to fix that, here's my example: http://jsbin.com/iyubi/edit Now, with a single click, the value on mouseup is reversed to keep it as it was with mousedown. But, when you do a drag, the mouseup of the last checkbox is not canceled or reversed... I suppose it would be enough to cancel $(this)'s mouseup, but how would you refer to $(this) from within the $boxes.bind('mouseover')? On 11 Apr, 16:07, Lwangaman donjohn.f...@gmail.com wrote: Hmm, just noticed one problem though... A single click on a checkbox is supposed to work too, but with this code as soon as you mouseup the value goes back the other way... You have to drag off in order to keep the value in there... On 11 Apr, 06:21, Ricardo ricardob...@gmail.com wrote: I think you already got the .dc namespacing thing, so: the mousedown is not being bound to the checkbox, but to the container element (the table, or in my example below, the UL). When you click a checkbox the mousedown event will bubble up to the container and fire this handler. As I expected my code had some flaws a few typing errors, see it fixed/ working here: http://jsbin.com/edabo/edit I added the ability to specify a selector for the checkboxes, that way you can skip the ones you don't want. In case it's not provided all checkboxes are used by default. cheers, - ricardo On Apr 10, 8:17 pm, Lwangaman donjohn.f...@gmail.com wrote: Ok first of all thanks for taking interest! Then, I've tried going through your code and applying it, and I have a few questions: -- Besides the mouseover.dc that I didn't get either... -- I'm supposing that $boxes would be a variable where all the checkboxes that are applicable have been stored previously? Yet, if you build it as a plugin you have no way of defining which checkboxes are to comprised (unless this functionality is built into the plugin using data passed through parameters, I suppose). -- Then I don't quite understand what the mousedown is
[jQuery] Re: Function Problem
I would imagine that this fixes your problem: $(document).ready(function(){ $(#showwhat).change( function(){ onSelectChange(#showwhat)); }); }); But I'm not sure that this is the best way to approach this particular problem. Try the code found here: http://jsbin.com/udamo Chuck Harmston http://chuckharmston.com On Sun, Apr 12, 2009 at 12:49 PM, djn12313 djn12...@gmail.com wrote: New to jQuery and trying to port a simple Select-Box-Value-Hides/Shows- a-Text-Box script from JS to jQuery. I'm sure this must be something simple, but it's driving me nuts. Note: The following function is just an example for testing. If I define call the Function below without any parms (e.g. explicitly set the #showwhat option:selected inside the function), it works fine. But I have 2 Select Boxes where I need this behavior and would like (if only for the sake of principle) to be able to pass in the Selector and Value. When passing in the Selector as a variable, the following snippet executes only when the document loads, but not when the Selection changes. As mentioned if I explicitly set the #showwhat option:selected inside the function the script executes the alert each time the Select Box value changes. Can anyone identify why this isn't working with the variable? Maybe a syntax problem forming the string with the variable? --- sample $(document).ready(function(){ $(#showwhat).change(onSelectChange(#showwhat)); }); function onSelectChange(test){ var selected = $(test + option:selected); var output = ; alert(selected.text()); if(selected.text() == Tomorrow){ output = You Selected + selected.text(); } $(#output).html(output); };
[jQuery] Re: Function Problem
How about something like this $(document).ready(function(){ $(#showwhat).change(function() { show_output( $(this).val () ); }); function show_output(selected) { var output = ; if(selected == Tomorrow) output = You Selected + selected; $(#output).html(output); } }); On Apr 12, 6:49 pm, djn12313 djn12...@gmail.com wrote: New to jQuery and trying to port a simple Select-Box-Value-Hides/Shows- a-Text-Box script from JS to jQuery. I'm sure this must be something simple, but it's driving me nuts. Note: The following function is just an example for testing. If I define call the Function below without any parms (e.g. explicitly set the #showwhat option:selected inside the function), it works fine. But I have 2 Select Boxes where I need this behavior and would like (if only for the sake of principle) to be able to pass in the Selector and Value. When passing in the Selector as a variable, the following snippet executes only when the document loads, but not when the Selection changes. As mentioned if I explicitly set the #showwhat option:selected inside the function the script executes the alert each time the Select Box value changes. Can anyone identify why this isn't working with the variable? Maybe a syntax problem forming the string with the variable? --- sample $(document).ready(function(){ $(#showwhat).change(onSelectChange(#showwhat)); }); function onSelectChange(test){ var selected = $(test + option:selected); var output = ; alert(selected.text()); if(selected.text() == Tomorrow){ output = You Selected + selected.text(); } $(#output).html(output); };
[jQuery] Finding ID within Ajax response
I have an ajax GET call that returns the HTML of a page on my server. Within that page is a form with a specific ID. I know it is there, I can see it in the response in Firebug, but when I try to get attributes of that ID, it always returns undefined! What have I done wrong here? success: function(html){ $(html).find('#main_form').each(function() { var linking_data = $(this).serialize(); var form_action = $(this).attr('action'); alert(form_action); }); } I have tried to not use each() and that still returns undefined. I don't get it.
[jQuery] jQuery Cycle plugin - addslide (again)
I read a lot of posts about this issue, but can not find a solution. Also have seen the addSlide examples for the jQuery cycle plugin. I try to add slides to the cycle plugin with AJAX, one slide at a time with the following code. function onBefore(curr, next, opts, fwd) { // on Before arguments: // curr == DOM element for the slide that is currently being displayed // next == DOM element for the slide that is about to be displayed // opts == slideshow options // fwd == true if cycling forward, false if cycling backward //Slide html creation helper. function ddblockGetSlideHTML(slideImg) { return 'img src=' + slideImg + ' width=200 height=200 alt=/'; }; opts.ajaxLoadSlides = 1; // Will be set later from UI opts.totalSlideCount = 6; //Will be set later from UI //load slides dynamically if (opts.ajaxLoadSlides) { // on the first pass, addSlide is undefined (plugin hasn't yet created the fn); // when we're finshed adding slides we'll null it out again if (!opts.addSlide){ return; } if (opts.nextSlide + 1 == opts.totalSlideCount) { // final slide in our slide slideshow is about to be displayed // so there are no more to fetch alert('last slide to be dislayed, nothing to add anymore'); opts.addSlide = null; return; } // Retrieve slide from server via AJAX, call; if successful the // anonymous function in voteSaved is run. $.ajax({ type: 'POST', // Use the POST method. url: 'get_image_slides', dataType: 'json', data: {js:true,origin:'ddblock',curr_slide:opts.currSlide,next_slide:opts.nextSlide,delta:opts.ddblocknr}, success: function(data) { // add our next slide opts.addSlide(ddblockGetSlideHTML(data.slideImg), fwd == true); }, error: function(xhr) { //alert('Error: ' + xhr.status + ' ' + xhr.statusText); } }); } } I first have 2 initial images after that, images are loaded with AJAX The ajax call returns the image ok The problem is that opts.currSlide and opts.Nextslide give strange values so the wrong images are selected. When I look in FF console the post values for currSlide and nextSlide are. 0 - 1 2 - 1 2 - 3 4 - 1 2 - 3 4 - 5 I get the images in the PHP script on nextSlide +2 So i expect : 0 - 1 - get image 3 1 - 2 - get image 4 2 - 3 - get image 5 3 - 4 - get image 6 Another problem is I use slideExpr to select the right content to slide. How can I you use addslide to add slides to the SlideExpr.parent Thanks in advance for any help with this issue Philip Blaauw
[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery
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 could be put under your name because you did all the big work! On 12 Apr, 14:35, Lwangaman donjohn.f...@gmail.com wrote: Ok that works better, I just changed clicked.checked = !isChecked to clicked.checked = isChecked: http://jsbin.com/idihi/edit On 12 Apr, 08:11, Ricardo ricardob...@gmail.com wrote: The problem with your fix is that the event target for the mouseup is not the same as the mousedown. You can resolve that by saving the clicked checkbox in a var, and because of event order the change has to be made on 'click' rather than mouseup. http://jsbin.com/asizu/edit Sorry for the bugs, this was written rather quickly, I hope it works now :) On Apr 11, 11:30 am, Lwangaman donjohn.f...@gmail.com wrote: Ok I tried to touch up the code a little to fix that, here's my example: http://jsbin.com/iyubi/edit Now, with a single click, the value on mouseup is reversed to keep it as it was with mousedown. But, when you do a drag, the mouseup of the last checkbox is not canceled or reversed... I suppose it would be enough to cancel $(this)'s mouseup, but how would you refer to $(this) from within the $boxes.bind('mouseover')? On 11 Apr, 16:07, Lwangaman donjohn.f...@gmail.com wrote: Hmm, just noticed one problem though... A single click on a checkbox is supposed to work too, but with this code as soon as you mouseup the value goes back the other way... You have to drag off in order to keep the value in there... On 11 Apr, 06:21, Ricardo ricardob...@gmail.com wrote: I think you already got the .dc namespacing thing, so: the mousedown is not being bound to the checkbox, but to the container element (the table, or in my example below, the UL). When you click a checkbox the mousedown event will bubble up to the container and fire this handler. As I expected my code had some flaws a few typing errors, see it fixed/ working here: http://jsbin.com/edabo/edit I added the ability to specify a selector for the checkboxes, that way you can skip the ones you don't want. In case it's not provided all checkboxes are used by default. cheers, - ricardo On Apr 10, 8:17 pm, Lwangaman donjohn.f...@gmail.com wrote: Ok first of all thanks for taking interest! Then, I've tried going through your
[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery
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 could be put under your name because you did all the big work! On 12 Apr, 14:35, Lwangaman donjohn.f...@gmail.com wrote: Ok that works better, I just changed clicked.checked = !isChecked to clicked.checked = isChecked: http://jsbin.com/idihi/edit On 12 Apr, 08:11, Ricardo ricardob...@gmail.com wrote: The problem with your fix is that the event target for the mouseup is not the same as the mousedown. You can resolve that by saving the clicked checkbox in a var, and because of event order the change has to be made on 'click' rather than mouseup. http://jsbin.com/asizu/edit Sorry for the bugs, this was written rather quickly, I hope it works now :) On Apr 11, 11:30 am, Lwangaman donjohn.f...@gmail.com wrote: Ok I tried to touch up the code a little to fix that, here's my example: http://jsbin.com/iyubi/edit Now, with a single click, the value on mouseup is reversed to keep it as it was with mousedown. But, when you do a drag, the mouseup of the last checkbox is not canceled or reversed... I suppose it would be enough to cancel $(this)'s mouseup, but how would you refer to $(this) from within the $boxes.bind('mouseover')? On 11 Apr, 16:07, Lwangaman donjohn.f...@gmail.com wrote: Hmm, just noticed one problem though... A single click on a checkbox is supposed to work too, but with this code as soon as you mouseup the value goes back the other way... You have to drag off in order to keep the value in there... On 11 Apr, 06:21, Ricardo ricardob...@gmail.com wrote: I think you already got the .dc namespacing thing, so: the mousedown is not being bound to the checkbox, but to the container element (the table, or in my example below, the UL). When you click a checkbox the
[jQuery] Re: Function Problem
If you really must pass the select object then try something like this $(document).ready(function(){ $(#showwhat).change(function() { show_output( $(this) ); }); function show_output(my_select) { var selected = my_select.val() ; var output = ; if(selected == Tomorrow) output = You Selected + selected; $(#output).html(output); } }); On Apr 12, 11:55 pm, Ryan ryank...@gmail.com wrote: How about something like this $(document).ready(function(){ $(#showwhat).change(function() { show_output( $(this).val () ); }); function show_output(selected) { var output = ; if(selected == Tomorrow) output = You Selected + selected; $(#output).html(output); } }); On Apr 12, 6:49 pm, djn12313 djn12...@gmail.com wrote: New to jQuery and trying to port a simple Select-Box-Value-Hides/Shows- a-Text-Box script from JS to jQuery. I'm sure this must be something simple, but it's driving me nuts. Note: The following function is just an example for testing. If I define call the Function below without any parms (e.g. explicitly set the #showwhat option:selected inside the function), it works fine. But I have 2 Select Boxes where I need this behavior and would like (if only for the sake of principle) to be able to pass in the Selector and Value. When passing in the Selector as a variable, the following snippet executes only when the document loads, but not when the Selection changes. As mentioned if I explicitly set the #showwhat option:selected inside the function the script executes the alert each time the Select Box value changes. Can anyone identify why this isn't working with the variable? Maybe a syntax problem forming the string with the variable? --- sample $(document).ready(function(){ $(#showwhat).change(onSelectChange(#showwhat)); }); function onSelectChange(test){ var selected = $(test + option:selected); var output = ; alert(selected.text()); if(selected.text() == Tomorrow){ output = You Selected + selected.text(); } $(#output).html(output); };
[jQuery] Re: jQuery Documentation
The jQuery-dev group is a good place for those kinds of suggestions/discussions. On Sun, Apr 12, 2009 at 6:30 PM, will willthem...@gmail.com wrote: Hi, Was wondering if there is a specific active group for the jQuery documentation project? I'd love to see a system sort of like php.net that allows users to post relevant code examples. to do this, use this. I have trouble connecting the dots sometimes and those examples can really help. Judging from the traffic here on the list, I'm guessing I'm not alone in this (the trouble connecting the dots part). also, if we see weird stuff in the docs, who do we tell? For instance, searching for form on the site brings up http://docs.jquery.com/Form which, I'm guessing, is a mistake. :) Will
[jQuery] Re: .each - how to write in my code?
what jay said so for example instead of $(ul#menu a) try $(a, this) where you are selecting all the a tags in the context of this which represents the individual li tag as you iterate through the each loop. On Sun, Apr 12, 2009 at 12:18 PM, jay jay.ab...@gmail.com wrote: inside the each you need to reference this or $(this) instead of referencing all of the elements again. On Apr 12, 11:38 am, adesign andersek...@gmail.com wrote: Hello, I am very new to jQuery and don´t know how to write my code for every item. Here is my code for a list with hover functions, I would like for every item to be processed separately. I know about a functio that is written .each, but can´t seem to get it to work. --- script type=text/javascript $(function() { // set opacity to nill on page load $(ul#menu span).css(opacity,0); $(ul#menu li).each(function () { // on mouse over $(ul#menu a).hover(function () { // animate opacity to full $('ul#menu span').stop().animate({ opacity: 1 }, 'slow'); }, // on mouse out function () { // animate opacity to nill $('ul#menu span').stop().animate({ opacity: 0 }, 'slow'); }); }); }); /script --- hope someone has some answers or a book to recommend for a newbie. Regards /adesign
[jQuery] Re: jQuery Form Validation
It still doesn't validate when the field is empty. Yes, I removed required: true, in $(#myform).validate({ rules: { field: { required: true, email: true } } }); The code is exactly the same just without the required: true, line as belows. And if I modified the input id=field name=field / to input class=left id=field name=field onblur=alert($(#field).valid ()) / It alerts 0 when it's empty, 0 when it's invalid email, and 1 when it's valid email address. I'm expecting 1 when field is empty. !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head script src=http://code.jquery.com/jquery-latest.js;/script script type=text/javascript src=http://dev.jquery.com/view/trunk/ plugins/validate/lib/jquery.delegate.js/script script type=text/javascript src=http://dev.jquery.com/view/trunk/ plugins/validate/jquery.validate.js/script script type=text/javascript jQuery.validator.setDefaults({ debug: true, success: valid });; /script script $(document).ready(function(){ $(#myform).validate({ rules: { field: { email: true } } }); }); /script style#field { margin-left: .5em; float: left; } #field, label { float: left; font-family: Arial, Helvetica, sans- serif; font-size: small; } br { clear: both; } input { border: 1px solid black; margin-bottom: .5em; } input.error { border: 1px solid red; } label.error { background: url('http://dev.jquery.com/view/trunk/plugins/validate/ demo/images/unchecked.gif') no-repeat; padding-left: 16px; margin-left: .3em; } label.valid { background: url('http://dev.jquery.com/view/trunk/plugins/validate/ demo/images/checked.gif') no-repeat; display: block; width: 16px; height: 16px; } /style /head body form id=myform label for=fieldRequired, email: /label input class=left id=field name=field / br/ input type=submit value=Validate! / /form /body /html On Apr 12, 3:36 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Just remove the required-rule. All other methods include a check to make a field optional when empty. Jörn On Sat, Apr 11, 2009 at 7:16 PM, NobitaNobi79 frankcheun...@gmail.com wrote: Hi, I am new to jQuery. I follow the example on http://docs.jquery.com/Plugins/Validation/Methods/emailto add rules to a form validator. When I modified the rules to email: true (required: false), the script seems to stall there, no error message nor a check. Can someone tell me if I am doing anything wrong here? What I want is to let the validation pass if the optional fields are valid when they are filled or they are left out empty. I can, of course add an extra script like... if (($(#field).val() == ) || $(#field).valid()) { optionalValid = true; } But it seems very redundant considering the rules: { field: {email: true, required: false}}, with or without the default required: false option. Thanks
[jQuery] Re: .each - how to write in my code?
That's unnecessary, you can use the .hover method directly on the anchors without the need for .each(), the iteration happens automatically: $(ul#menu li a).hover(function(){ // animate opacity to full $(this).find('span').stop().fadeIn('slow'); }, function(){ // animate opacity to zero $(this).find('span').stop().fadeOut('slow'); }); On Apr 12, 10:25 pm, Ralph Whitbeck ralph.whitb...@gmail.com wrote: what jay said so for example instead of $(ul#menu a) try $(a, this) where you are selecting all the a tags in the context of this which represents the individual li tag as you iterate through the each loop. On Sun, Apr 12, 2009 at 12:18 PM, jay jay.ab...@gmail.com wrote: inside the each you need to reference this or $(this) instead of referencing all of the elements again. On Apr 12, 11:38 am, adesign andersek...@gmail.com wrote: Hello, I am very new to jQuery and don´t know how to write my code for every item. Here is my code for a list with hover functions, I would like for every item to be processed separately. I know about a functio that is written .each, but can´t seem to get it to work. --- script type=text/javascript $(function() { // set opacity to nill on page load $(ul#menu span).css(opacity,0); $(ul#menu li).each(function () { // on mouse over $(ul#menu a).hover(function () { // animate opacity to full $('ul#menu span').stop().animate({ opacity: 1 }, 'slow'); }, // on mouse out function () { // animate opacity to nill $('ul#menu span').stop().animate({ opacity: 0 }, 'slow'); }); }); }); /script --- hope someone has some answers or a book to recommend for a newbie. Regards /adesign
[jQuery] Re: simple query does not work
.get(0) returns a DOM element, not a jQuery object, so the .css method doesn't exist in it. Try this: $(div#photolinks img).eq(0).css(border,5px solid black;); or $(div#photolinks img:first).css(border,5px solid black;); On Apr 12, 8:03 pm, dongle tetri...@gmail.com wrote: nop, there are too get ; one that acts like the javascript index(i) method:http://docs.jquery.com/Core/get i am referring to that one, :first would not help me here. On Apr 13, 12:57 am, Chuck Harmston cpharms...@gmail.com wrote: I'm not quite sure what you're trying to do here. The $.get() function is used to submit an HTTP GET request. See: http://docs.jquery.com/Ajax/jQuery.get Are you trying to return the first response? Try using $(div#photolinks img:first). Chuck Harmstonhttp://chuckharmston.com On Sun, Apr 12, 2009 at 5:41 PM, dongle tetri...@gmail.com wrote: i am making this(it does not work) : $(document).ready(function(){ $(div#photolinks img).get(0).css(border,5px solid black;); }); if i do this: $(document).ready(function(){ $(div#photolinks img).css(border,5px solid black;); }); it does work, whats wrong? thanks