[jQuery] Re: simple question regarding the 'this' keyword
I would suggest removing the thmb1, thmb2, thmb3 classes and use a static class like thmb so you can create a single function that handles all of your links. You can then create a single function to grab the src attribute of the child img tag and load up the hi res version of the image. For example if the thumbnail is item1.jpg you would load up item1_large.jpg. On Aug 9, 10:59 am, Cyra matt.penfi...@gmail.com wrote: Hello, First time posting here, so sorry if this has been covered to death, but I couldn't find anything via searching. I'm building a gallery page, that's setup like this: - carousel based horizontal image thumbnail navigation. - main div that loads, on thumbnail click, a high res version of each thumbnail image that exists within the carousel nav. so basically: code div id=main_div !-- high res image will be loaded here via ajax -- /div div id=carousel ul lia class=thmb1 href=###img src=item1.jpg //a/li lia class=thmb2 href=###img src=item2.jpg //a/li lia class=thmb3 href=###img src=item3.jpg //a/li /ul /div /code now, i realize i could simply write a line of jquery to load each and every thumbnail, i.e. code $(#carousel ul li a.thmb1).click(function () { $(#main_div).load(/high_res_images.html #image1); }); /code but that seems incredibly innefficient, and might be too complicated for my non-technical client to maintain. I'm wondering if I could set something up using the 'this' keyword, or 'each' to make this much more efficient, and would allow me to add new items to the carousel without updating the code. thanks so much for reading, i realize this is probably simpler than I think it is, but I'm new to js and jquery (loving it so far though!) -matt
[jQuery] Re: Attribute selection not working in MSIE; eg $(input[name=name]).val()
Ok, that works. But now when adding a second selector it fails at the second. var company = $(#contactform div input[name='name']).val(); var company = $(#contactform div input[name='company']).val(); This is even weirder :o
[jQuery] Re: Attribute selection not working in MSIE; eg $(input[name=name]).val()
The solutions, adding; var name = ; var company = ; Strange this wasnt needed before :o
[jQuery] Re: li/img click and window.keydown
Up On 23 juil, 08:30, Lideln lid...@gmail.com wrote: Up On 20 juil, 18:46, Lideln lid...@gmail.com wrote: Hi, Thanks for the answer. Here is a bit of my script : [code] // Constructing the modal... SModule_gallery.oGalleryModal.jqm({modal: true}) .width((SModule_gallery.GALLERY_COLS * (SModule_gallery.GALLERY_ITEM_WIDTH + 10)) + 4) // 6 et 4 correspondent à des paddings .height(iHeight + 4 + 32) // 32 = height approximative du title .draggable({handle: 'h1'}); $(window).keydown(SModule_gallery.onKeyDown); onKeyDown: function(oEvent) { if (oEvent.keyCode == 27) SModule_gallery.hideGalleryModal(); }, hideGalleryModal: function() { SModule_gallery.oGalleryModal.jqmHide(); $(window).unbind('keydown', SModule_gallery.onKeyDown); }, // Data inside the modal : looping over an ajax answer, displaying several thumbnails sStr += 'li id=galleryThumbnailItem_' + iId + '\ img src=' + SDefines.sUrlAjax + 'getFilePreview.php? fileId=' + iId + 'square=' + SModule_gallery.GALLERY_ITEM_WIDTH + ' title=' + sName + ' /\ /li'; [/code] When I open the modal, and immediately press escape, this works fine : the modal hides itself. But when I first click on a picture (that displays some information in the main window), and then press escape, I have to press escape another time to hide the modal. I could not succeed in catching the first escape event in an event listener (either on $(window), or on the li item, or on the img item) Thanks for any help ! :) On 20 juil, 12:19, Liam Potter radioactiv...@gmail.com wrote: show us you script and stop bumping so often. Lideln wrote: Up ! On 17 juil, 22:47, Lideln lid...@gmail.com wrote: Up ! :) On 16 juil, 22:32, Lideln lid...@gmail.com wrote: up On 16 juil, 08:10, Lideln lid...@gmail.com wrote: up ! (wow, this forum gets 10 new posts per hour) On 15 juil, 21:52, Lideln lid...@gmail.com wrote: Hi everybody ! I have a jqModal window, and I would like to close it using the ESC key. For that purpose, I assign my modal a keydown() event, and if keyCode == 27, I close the modal. It works fine, except when I click on another element in the modal first I have to press 2 times ESC : the first time removes the focus from the element, the second time goes through my listener and closes the modal. In my modal , I have an ul/li list, each li containing an img (for the purpose of an image gallery). When I click on an image (or li ?), I have to press twice ESC to close the modal. I tried to add a $(this).blur() in the li click() event, and also I tried to put that in the img click event, but without success... Does somebody know why it is doing that, and how to fix it, please ? Thanks a lot !
[jQuery] Re: Attribute selection not working in MSIE; eg $(input[name=name]).val()
a shorter solution for your code should be, giving the input field an unique id On Aug 10, 9:46 am, V vincenti...@gmail.com wrote: The solutions, adding; var name = ; var company = ; Strange this wasnt needed before :o
[jQuery] Re: calling a jQuery function from RJS/onclick
implementing the live() function solved this problem. http://docs.jquery.com/Events/live#typefn On Aug 10, 9:53 am, Ram yourstruly.vi...@gmail.com wrote: anyone? any ideas at all?? On Aug 7, 4:38 pm, Ram yourstruly.vi...@gmail.com wrote: Hi, Im using jNice (a jQuery plugin) in rails. I have the following jQuery function on the head of my page. script type=text/javascript jQuery.noConflict(); /* calling jNice on document ready */ jQuery(document).ready(function($) { $('div.jNice').jNice(); }); . /script On page load, this gets called correctly. Now there's a link on the page that lets me add more rows and i do this viaRJS. Here's the code. tr id=empty_item div id=plussign%= add_item_link + %/div /tr def add_item_link(name) link_to_function name do |page| page.insert_html :before, :empty_item, :partial='item', :object = Item.new end end Now this partial 'item' contains form elements upon which jNice needs to work its magic. How can I call the jNice function after the user clicks on the add_item_link? Thanks.
[jQuery] can't return value after $.ajax call
Hi i'm currently using the dialog functionality (modal form) from UI library to submit data to the database. All the validation checks have been running ok until one of the validation checks requires a ajax call to check if a username exsist in the database. I'm fairly new to both javascript and jquery so this could be a fairly basic blunder. Initially, i thought it was an sycronicity problem, but I changed the $.ajax async option to true but still no joy, so maybe it something to do with scope etc? Here's the code and thanks for any help in advance. function checkIfUsername() { $.ajax({ type: POST, url: +CI_ROOT+index.php/admin/check_if_username, data: ({username: username.val()}), async: false, dataType: json, success: function(data){ returnUsernameBool(username, data); } }); } function returnUsernameBool(o, data) { if(data.bool == true){ o.addClass('ui-state-error'); updateTips(Your username must be unique); alert('false'); //this works return false; //still can't return bool } else{ alert('true'); //this works return true; //still can't return bool } } bValid = bValid checkIfUsername(username); alert(bValid); //still gives undefined
[jQuery] Re: can't return value after $.ajax call
aside from the fact that checkIfUsername does not have a return ajax function is not going to waitwhen you finished calling $.ajax your function has already ended(returned) then when server responded your returnUsernameBool will be called but thats already too late for your alert(bValid) thinking as $.ajax is creating another thread and your callback is run in it might help (eventhough javascript is single threaded)
[jQuery] Re: can't return value after $.ajax call
Hi Steven, Thank you for your reply but i'm not sure i understand what you mean? By having async set to false the script does wait for the value to come back from the server before executing the rest of the script (i can tell it does this because all the alerts i run to test it, run in the order i would expect). The return function is set in the success option of the $.ajax method which calls the returnUsernameBool function. Initially(see below), i had just one function but tried breaking it in two to see if that would give me some clue as to why it wasn't working function checkIfUsername(o) { $.ajax({ type: POST, url: +CI_ROOT+index.php/admin/check_if_username, data: ({username: username.val()}), async: false, dataType: json, success: function(data){ if(data.bool == true){ o.addClass('ui-state-error'); updateTips(Your username must be unique); return false; } else{ return true; } } }); } //check id username already exsists bValid = bValid checkIfUsername(username); On Aug 10, 11:25 am, Steven Yang kenshin...@gmail.com wrote: aside from the fact that checkIfUsername does not have a return ajax function is not going to waitwhen you finished calling $.ajax your function has already ended(returned) then when server responded your returnUsernameBool will be called but thats already too late for your alert(bValid) thinking as $.ajax is creating another thread and your callback is run in it might help (eventhough javascript is single threaded)
[jQuery] Re: can't return value after $.ajax call
if thats the case try function checkIfUsername(o) { var bool; $.ajax({ type: POST, url: +CI_ROOT+index.php/admin/check_if_username, data: ({username: username.val()}), async: false, dataType: json, success: function(data){ if(data.bool == true){ o.addClass('ui-state-error'); updateTips(Your username must be unique); //return false; bool = false; } else{ //return true; bool = true; } } }); return bool; } i am not very familiar with the case that async:false but from what you described, this should work
[jQuery] jQuery readonly input text and ie6
Hallo all. I got e problem with this piece of code with ie6. I'm trying to make an input text readonly with a predefined value and I need to cancel the value only when some key is pressed on keyboard. Her is the code http://pastie.org/578280 The code do work on every browser except ie6 (on ie6 the input text seems not to receive the focus when is readonly and so the event is not fired up). Any idea Kind regards MAssimo
[jQuery] Re: can't return value after $.ajax call
Thank you, that has worked. I tried exactly the same thing before because i though that returning the boolean from within the $.ajax method might not work. However instead of using bool = true; i was using var bool = true;. Have you any idea why using the prefix of var would stop this working? On Aug 10, 11:52 am, Steven Yang kenshin...@gmail.com wrote: if thats the case try function checkIfUsername(o) { var bool; $.ajax({ type: POST, url: +CI_ROOT+index.php/admin/check_if_username, data: ({username: username.val()}), async: false, dataType: json, success: function(data){ if(data.bool == true){ o.addClass('ui-state-error'); updateTips(Your username must be unique); //return false; bool = false; } else{ //return true; bool = true; } } }); return bool; } i am not very familiar with the case that async:false but from what you described, this should work
[jQuery] Re: Regular Expression validation
I'm not that good with javascript. If the textboxt name is txtname, how do you incorporate it in the code above???
[jQuery] How to check status of image loading ?
Hello, I use JS to change src of img to load different images from remote server in the same object. if the image is available then everything works perfect, but when I cannot download image the img becomes blank (as expected). My question is, can I check somehow if image is not loaded (ex. error 404) ? So if no image can be downloaded i could display something like 'image not available' instead of blank screen.
[jQuery] validate | Validation not Initiating on Pressing Enter Key on IE8
Hi, Form is not getting validated on Pressing Enter Key only on IE8. However its working fine on IE7/6, Firefox. I am showing this form on mouseover (So initially form display is none on onmouse over of a link form display property changed to block.) Thanks, Prabir
[jQuery] how convert low jquery version function to new version?
hi, this is jquery table editor plugin, http://dev.iceburg.net/jquery/tableEditor/demo.php it is work in this version /* * jQuery 1.0.3 - New Wave Javascript * * Copyright (c) 2006 John Resig (jquery.com) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * $Date: 2006-10-27 11:15:44 -0400 (Fri, 27 Oct 2006) $ * $Rev: 501 $ */ and the function is script type=text/javascript $().ready(function() { $(#editableTable).tableSorter({ sortColumn: 'First Name', // Integer or String of the name of the column to sort by. sortClassAsc: 'headerSortUp', // class name for ascending sorting action to header sortClassDesc: 'headerSortDown',// class name for descending sorting action to header headerClass: 'header', // class name for headers (th's) disableHeader: 'ID' // DISABLE Sorting on ID }).tableEditor({ EDIT_HTML: 'EDIT2', SAVE_HTML: 'Save', FUNC_PRE_EDIT: 'preEdit', //not working jquery 1.3.2 FUNC_POST_EDIT: 'postEdit',//not working jquery 1.3.2 FUNC_PRE_SAVE: 'preSave', //not working jquery 1.3.2 FUNC_UPDATE: 'updateTable' //not working jquery 1.3.2 }); }); function updateTable(o) { alert('FUNC_UPDATE called'); } function preSave(o) { alert('FUNC_PRE_SAVE called'); } function postEdit(o) { alert('FUNC_POST_EDIT called'); } function preEdit(o) { alert('FUNC_PRE_EDIT called'); } /script it is not working latest version jquery-1.3.2 table sorter fuction is working new version and tableEditor function is not working tell your suggestion how i write this table editor function to latest jquery version
[jQuery] Disable submit button with Validation plugin
I need help with the Validation plugin. I have a form with a required field. When the form is valid I want the form to submit and I also want to disable the submit button. I have a function that does the disabling, but I'm not sure how to call this function within the validate method. Here is my simple call the the validate method. $(document).ready(function() { $(#myForm).validate() }); and here is my disable function -- jQuery.fn.diableOnSubmit = function() { var input=this.find(input.submit) input.click(function () { $(this).attr(disabled, true); $(this).attr(value, Submitting...); $(this).submit(); }); }; How do I combine the two together? -Cheers, Rich
[jQuery] jQuery Clash with other javascript?
Hi, So I'm trying to create a simple overly but I think i'm doing something wrong with the ordering of my javascript or something, the page is http://blackpaint.co.uk/BlackPaint09/offline/flash-background/index.html here is the overlay by itself (working version) http://blackpaint.co.uk/BlackPaint09/JquearyTESTS/Delete.html which is this: script src=cdn.jquerytools.org 1.0.2 jquery.tools.min.js/script script src=../../Scripts/swfobject_modified.js type=text/ javascript/script script type=text/javascript $(function() { $(button[rel]).overlay(); }); /script link href=../css/overlay-minimal.css rel=stylesheet type=text/ css / /head body button type=button rel=#overlayOpen overlay/button div class=overlay id=overlay Overlay test /div /body /html Anybody know where i've gone wrong? Thank you
[jQuery] AJAX calls acting syncronously
Hi there I am a newbie to using jquery and have been exploring it developing a new app. At the moment I have a number of AJAX calls to the server which I have been queueing in an array and using a single $.ajax call to handle all of them. However I know about the browser limitations of two calls per page (at the same time and want to implement this to speed up page updating). To test concurrent ajax requests I have setup various asp pages to with delays 1sec, 5sec, 10sec etc etc. and a test html file with the follwing javascript $('#btn1', '#divTest').click(function(event){ $.ajax({ url: 'include/asp/test/one_secs.asp', type: 'GET', cache: 'false', processData: false, success: function(data, txtStatus) { alert(data); }, }); }); $('#btn10', '#divTest').click(function(event){ $.ajax({ url: 'include/asp/test/ten_secs.asp', type: 'GET', cache: 'false', processData: false, success: function(data, txtStatus) { alert(data); }, }); }); so now when I click on btn1 it returns the call after 1sec as it should, and the 10sec button after 10 seconds all good. When I click the 10 seconds first, quickly followed by the 1second button I expect the 1second to return first followed by the 10 second... This doesn't happen it still processes the 10second first and returns the 1second after the 10second is finished. Am I missing something here I have seen something in other forums that suggest it may be server related (server queuing the requests) ? Also I apologise if this has been discussed before (I have been searching all morning for a solution), buthaven't found anything.. any help would be brilliant
[jQuery] (Validate) Error messages in Summary section
Hi, I'm new to jQuery and the validation plugin, I just wondered if it is possible to get the error messages to be shown in an error summary section instead of inline? Cheers, Daz
[jQuery] $ajax() problem
$.ajax({ type: POST, url: mywebpage.aspx?Arg=+args2, contentType: text, data:{}, dataType: text, success: CompleteInsert, error: onFail }); I dont know why the onFail function is going to be executed when args2 is too big. args2 is a string type can anyone explain this thanks
[jQuery] can all jQuery code be included in just one $(function(){}); ?
I Include my javascript in an includefile. Which is better way to organize the jQuery code: $(function(){ $(.myboxclass).corner(7px); $(#myrandomdiv).corner(7px); }); or $(function(){ $(.myboxclass).corner(7px); }); $(function(){ $(#myrandomdiv).corner(7px); }); that is in two sections. Is the last just wasting space? they seem to be working the same. Thanks.
[jQuery] Re: simple question regarding the 'this' keyword
to get you started, you can use the each method, something like $('#carousel ul li a').each( function(){ //$(this) equals the current a element var src = $(this).children(img); //do other stuff here } ); On Aug 10, 2:24 am, svanhess vanh...@gmail.com wrote: I would suggest removing the thmb1, thmb2, thmb3 classes and use a static class like thmb so you can create a single function that handles all of your links. You can then create a single function to grab the src attribute of the child img tag and load up the hi res version of the image. For example if the thumbnail is item1.jpg you would load up item1_large.jpg. On Aug 9, 10:59 am, Cyra matt.penfi...@gmail.com wrote: Hello, First time posting here, so sorry if this has been covered to death, but I couldn't find anything via searching. I'm building a gallery page, that's setup like this: - carousel based horizontal image thumbnail navigation. - main div that loads, on thumbnail click, a high res version of each thumbnail image that exists within the carousel nav. so basically: code div id=main_div !-- high res image will be loaded here via ajax -- /div div id=carousel ul lia class=thmb1 href=###img src=item1.jpg //a/li lia class=thmb2 href=###img src=item2.jpg //a/li lia class=thmb3 href=###img src=item3.jpg //a/li /ul /div /code now, i realize i could simply write a line of jquery to load each and every thumbnail, i.e. code $(#carousel ul li a.thmb1).click(function () { $(#main_div).load(/high_res_images.html #image1); }); /code but that seems incredibly innefficient, and might be too complicated for my non-technical client to maintain. I'm wondering if I could set something up using the 'this' keyword, or 'each' to make this much more efficient, and would allow me to add new items to the carousel without updating the code. thanks so much for reading, i realize this is probably simpler than I think it is, but I'm new to js and jquery (loving it so far though!) -matt
[jQuery] Re: Disable submit button with Validation plugin
Try this: $(document).ready(function() { $(#myForm).validate({ submitHandler: function(form) { $(form).find(:submit).attr(disabled, true).attr(value, Submitting...); form.submit(); } }) }); Jörn On Mon, Aug 10, 2009 at 9:40 AM, Rich Sturimcosmos99...@gmail.com wrote: $(document).ready(function() { $(#myForm).validate() });
[jQuery] Question regarding jQuery.ready method
I have developed a FF extension that loads a few JavaScript files (one of which is jQuery) and attaches them to any given page being viewed by the user. The loading of the js files can ether happen during or after the web page had been loaded into the browser. Obviously, once the js files get loaded, I want to start doing some stuff and I wanted to use the jQuery.ready method to determine when the js code can start performing whatever needs to be done. However, it does not seem to get fired if the extension only starts loading the js files after the web page has already been fully loaded. Generally, there does not seem to be a method in FF that tells me if the web page is loaded or not but rather, only an event that can get fired upon page load. Am I missing something? if not, is there a workaround?
[jQuery] Re: AJAX calls acting syncronously
Am I missing something here Yes, you are assuming that the results will come back in the order called, which totally is not the case the success function simply says when you return from this async call, run this, there is nothing in the logic about order There is an older plugin that could be used Ajax Queue (http:// www.google.com/search?q=ajax+queue), or you can adjust your code accordingly On Aug 10, 8:34 am, sak saks...@gmail.com wrote: Hi there I am a newbie to using jquery and have been exploring it developing a new app. At the moment I have a number of AJAX calls to the server which I have been queueing in an array and using a single $.ajax call to handle all of them. However I know about the browser limitations of two calls per page (at the same time and want to implement this to speed up page updating). To test concurrent ajax requests I have setup various asp pages to with delays 1sec, 5sec, 10sec etc etc. and a test html file with the follwing javascript $('#btn1', '#divTest').click(function(event){ $.ajax({ url: 'include/asp/test/one_secs.asp', type: 'GET', cache: 'false', processData: false, success: function(data, txtStatus) { alert(data); }, });}); $('#btn10', '#divTest').click(function(event){ $.ajax({ url: 'include/asp/test/ten_secs.asp', type: 'GET', cache: 'false', processData: false, success: function(data, txtStatus) { alert(data); }, }); }); so now when I click on btn1 it returns the call after 1sec as it should, and the 10sec button after 10 seconds all good. When I click the 10 seconds first, quickly followed by the 1second button I expect the 1second to return first followed by the 10 second... This doesn't happen it still processes the 10second first and returns the 1second after the 10second is finished. Am I missing something here I have seen something in other forums that suggest it may be server related (server queuing the requests) ? Also I apologise if this has been discussed before (I have been searching all morning for a solution), buthaven't found anything.. any help would be brilliant
[jQuery] Re: Attribute selection not working in MSIE; eg $(input[name=name]).val()
You should avoid using reserved words in your attributes, and also avoid names/ids that are also available as properties of forms. IE overwrites DOM methods/properties when you set the attribute: http://www.jibbering.com/faq/faq_notes/form_access.html#faComMis http://meyerweb.com/eric/thoughts/2005/08/29/reserved-id-values/ On Aug 6, 7:21 am, V vincenti...@gmail.com wrote: Just when you think you made something beautiful, MSIE screws it all up :( I tried to get values from a input box which works great in Firefox, but not in MSIE; $(input[name=name]).val(); Is there a workaround for MSIE to get this working or am I just doomed to use id's?
[jQuery] Re: Regular Expression validation
What I really wanted to do is use the jQuery validator and in the function set a validation that numbers are not allowed in a text input. For example I have this code: $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#signupform).validate({ rules: { firstname: required, lastname: required, username: { required: true, minlength: 2, remote: users.php } } }); }); How do I set the validation that no number are allowed in the firstname text box On Aug 10, 8:52 am, nouky a.noor...@gmail.com wrote: I'm not that good with javascript. If the textboxt name is txtname, how do you incorporate it in the code above???
[jQuery] Re: jQuery readonly input text and ie6
Ok I found the problem. The problem is that i want to bind the event on the Delete button keypress. But in ie the Delete button does not fire any keyCode. Any idea/workaround? Kind regards Massimo On Aug 10, 12:54 pm, m.ugues m.ug...@gmail.com wrote: Hallo all. I got e problem with this piece of code with ie6. I'm trying to make an input text readonly with a predefined value and I need to cancel the value only when some key is pressed on keyboard. Her is the code http://pastie.org/578280 The code do work on every browser except ie6 (on ie6 the input text seems not to receive the focus when is readonly and so the event is not fired up). Any idea Kind regards MAssimo
[jQuery] Re: Sloppy Documentation of Ajax Methods
I see your point, it's completely inconsistent. It's a wiki, anyone can fix that. How about this? jQuery.ajax() Start an HTTP request with custom parameters .load() Load HTML from an URL and insert into the selected element(s) jQuery.get() Load data using an HTTP GET request jQuery.getJSON() Load JSON data using an HTTP GET request jQuery.getScript() Load JavaScript code using an HTTP GET request and execute it jQuery.post() Load data using a POST request On Aug 10, 1:22 am, rickoshay treesp...@gmail.com wrote: Here are the descriptions for the Ajax methods: load -- Loads HTML from a remote file ... ajax -- Load a remote page ... get -- Load a remote page... getScript -- Load and execute a local javascript file... post -- Load a remote page... So, if we want arbitrary HTML we have to use load, but if we want a whole page (where is that defined?) we have to use ajax, get or post? The execute script function (called getScript for some reason) only works with local files? I believe it will work with any URI (local or remote) returning JavaScript (assuming same origin policy of course), and whether it came from a file isn't known to the caller. These functions should describe the type of HTTP request they make, and skip references to pages and files.
[jQuery] Re: jQuery readonly input text and ie6
Maybe this plugins will help you: http://code.google.com/p/js-hotkeys/ On Mon, Aug 10, 2009 at 10:36, Mazi m.ug...@gmail.com wrote: Ok I found the problem. The problem is that i want to bind the event on the Delete button keypress. But in ie the Delete button does not fire any keyCode. Any idea/workaround? Kind regards Massimo On Aug 10, 12:54 pm, m.ugues m.ug...@gmail.com wrote: Hallo all. I got e problem with this piece of code with ie6. I'm trying to make an input text readonly with a predefined value and I need to cancel the value only when some key is pressed on keyboard. Her is the code http://pastie.org/578280 The code do work on every browser except ie6 (on ie6 the input text seems not to receive the focus when is readonly and so the event is not fired up). Any idea Kind regards MAssimo
[jQuery] Re: can all jQuery code be included in just one $(function(){}); ?
According to the API, you can have as many $(function(){}); in a page as you'd like. http://docs.jquery.com/Events/ready It just depends on the needs of your project. If it's imperative that $ (#myrandomdiv).corner(7px) is applied after $(.myboxclass).corner (7px); completes, then leave them separate as in your second example. On Aug 10, 6:15 am, Jesper F jesperfjoel...@gmail.com wrote: I Include my javascript in an includefile. Which is better way to organize the jQuery code: $(function(){ $(.myboxclass).corner(7px); $(#myrandomdiv).corner(7px); }); or $(function(){ $(.myboxclass).corner(7px); }); $(function(){ $(#myrandomdiv).corner(7px); }); that is in two sections. Is the last just wasting space? they seem to be working the same. Thanks.
[jQuery] jQuery validation - Numbers not allowed
I have this code: $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#signupform).validate({ rules: { firstname: required, lastname: required, username: { required: true, minlength: 2, remote: users.php } } }); }); How do I set the validation that no number are allowed in the firstname text box
[jQuery] Re: Malsup Form Plugin and buttons tags
Ah I was going about it a bit wrong. I've taken out the ajaxSubmit of the click function and changed it to ajaxForm. The click function just adds the hidden fields now. Nick On Aug 6, 7:50 pm, Mike Alsup mal...@gmail.com wrote: My buttons are type submit and each have values. I believe it could be because I have a click event on the button and using ajaxSubmit to submit as I have to dynamically add some values into hidden fields. How can I submit the button without making another hidden field? Use ajaxForm instead of ajaxSubmit.
[jQuery] jquery tabs :: ul li a animation
Hello all, I am using the tabs with a fade in/out effect for the panels, it works nice. $(function() { $(#tabs).tabs({ collapsible: true,fx: { opacity: 'toggle'}, selected: -1 }); }); What I would like to do is a type of animation for the tab titles ( ul li a), so that when I click to one of those the selected one would appear in a smoother way, fadein/out etc.. I have tried various things, adding code lines in the inline script or trying to put something like fadeIn('slow') in the ui.tabs.js where it adds the selected class, but I haven't managed to achieve anything... Any ideas? Thanks
[jQuery] Plugin to view large photos
http://code.google.com/p/jquery-largephotobox/
[jQuery] Jquery Show/Hide playing up in Safari
Note: I have also posted this on jqueryhelp.com but I havent resolved this issue. http://www.jqueryhelp.com/viewtopic.php?p=9713 I have just started a new job and am building my first website for them. Im using Jquery to try and impress them but after trying and testing the site in Safari, I am stumped as to why such a basic function its going wrong. The script works fine in ie and firefox so Im pulling my hair out. I have stripped all the non necessary code out of this and placed the css and javascript inside the head. -- CODE -- html head style type=text/css html { font-size:16px; margin:0; padding:0 } body,div,p { margin:0; padding:0; background: #eee; } div#container { width:70.06em; height:20em; overflow: visible; background:#fff } div#blackContainer { height:20em; background:#000 } div#portfolio { display:none; width:51.75em; height:20em; background:#fc0; } div#blackPanel { width:51.75em; height:20em; background:#000 } div#whitePanel { padding-left:4.19em; height:20em; background:#fff } .panel { float:left } /style script type=text/javascript src=http://ajax.googleapis.com/ ajax/libs/jquery/1.3/jquery.min.js/script script $(document).ready(function(){ // All Jquery fucntions should reside in here // NEW FUNCTION SHOW PORTFOLIO TAB $(.showPortfolio).click(function () { $(#container).css({'width' : '103.5em', 'overflow' : 'hidden'}); $(#portfolio).show(1000); }); // NEW FUNCTION HIDE PORTFOLIO TAB $(.hidePortfolio).click(function () { $(#portfolio).hide(1000, function(){$ (#container).css({'width' : '70.06em', 'overflow' : 'visible'});}); }); // End Doc Ready }); /script /head body div id=container div id=blackContainer class=panel div id=portfolio class=panel style=a class=hidePortfolio href=#Hide Portfolio Tab/a/div div id=blackPanel class=panel style=a class=showPortfolio href=#Show Portfolio Tab/a/div /div !-- WHITE PANEL -- div id=whitePanel class=panel showPages style=White Panel/div !-- END WHITE PANEL-- /div /body /html END CODE If you load that code in firefox you will see that by clicking on 'show porfolio', a yellow div slides open and pushes the black div to the right. You click 'hide portfolio' and the black div slides back and the yellow div hides. You can open and close the portfolio div as often as you like and it works a treat. If you try doing the same in safari, it works the first time but then it starts pushing the black div down. I cant for the life of me think what it could be and I have spent ages on it. If one of you kind experts on here could have a quick look at it for me I would more grateful than you can imagine! Thanks in advance, Maffo
[jQuery] Re: Sloppy Documentation of Ajax Methods
2009/8/10 Shawn sgro...@open2space.com: ALL the functions (load, get, post, etc) are wrappers for the $.ajax() function. I only use $.ajax() now and tweak it to meet my needs... Makes for less confusion. Ajax by default will only load files that are in the same domain as the calling page. This is a browser security feature. (Use $.ajax() and jsonp to work around that.) So the getScript() function will follow this limitation as well if it is calling the new script via Ajax. getScript() and get() requesting JSONP are the odd ones out - the ajax() method detects these cases and loads them by creating a script element and injecting it into the DOM, so the same-origin policy doesn't apply. Regards, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/
[jQuery] JSONP + two different encoding results
I have an edit-in-place plugin I've created for my employer. We *need* to use iso-8859-1* I understand we can set the *response* to be in iso-8859-1 in ajax, but I also need the request to be, so that it's posted properly to our database. So, I'm posting with jsonp, and then getting the updated content via ajax. Two requests is sloppy, but the amount of network strain we'll save from edit-in-place makes this an acceptable reality. The problem being, on my test page, I send out some test data: a lowercase a with a grave accent above it. On my test page, looking in firebug, it sends it out as %E0, which is the correct hexcode for this character. When I use it in a production page however, it gets sent out as %C3%A0, which is a capital A with a tilde, followed by a space. has anyone else come across this? *I know the arguments for unicode, but frankly two developers aren't going to convince 75 editorial staff that they need to change the way they've done things for 10+ years. Java isn't available on the server and won't be anytime soon.
[jQuery] Re: Jquery Show/Hide playing up in Safari
can you post a test page with the code you posted above? On Aug 10, 9:00 am, maffo a...@thisisrealart.com wrote: Note: I have also posted this on jqueryhelp.com but I havent resolved this issue. http://www.jqueryhelp.com/viewtopic.php?p=9713 I have just started a new job and am building my first website for them. Im using Jquery to try and impress them but after trying and testing the site in Safari, I am stumped as to why such a basic function its going wrong. The script works fine in ie and firefox so Im pulling my hair out. I have stripped all the non necessary code out of this and placed the css and javascript inside the head. -- CODE -- html head style type=text/css html { font-size:16px; margin:0; padding:0 } body,div,p { margin:0; padding:0; background: #eee; } div#container { width:70.06em; height:20em; overflow: visible; background:#fff } div#blackContainer { height:20em; background:#000 } div#portfolio { display:none; width:51.75em; height:20em; background:#fc0; } div#blackPanel { width:51.75em; height:20em; background:#000 } div#whitePanel { padding-left:4.19em; height:20em; background:#fff } .panel { float:left } /style script type=text/javascript src=http://ajax.googleapis.com/ ajax/libs/jquery/1.3/jquery.min.js/script script $(document).ready(function(){ // All Jquery fucntions should reside in here // NEW FUNCTION SHOW PORTFOLIO TAB $(.showPortfolio).click(function () { $(#container).css({'width' : '103.5em', 'overflow' : 'hidden'}); $(#portfolio).show(1000); }); // NEW FUNCTION HIDE PORTFOLIO TAB $(.hidePortfolio).click(function () { $(#portfolio).hide(1000, function(){$ (#container).css({'width' : '70.06em', 'overflow' : 'visible'});}); }); // End Doc Ready }); /script /head body div id=container div id=blackContainer class=panel div id=portfolio class=panel style=a class=hidePortfolio href=#Hide Portfolio Tab/a/div div id=blackPanel class=panel style=a class=showPortfolio href=#Show Portfolio Tab/a/div /div !-- WHITE PANEL -- div id=whitePanel class=panel showPages style=White Panel/div !-- END WHITE PANEL-- /div /body /html END CODE If you load that code in firefox you will see that by clicking on 'show porfolio', a yellow div slides open and pushes the black div to the right. You click 'hide portfolio' and the black div slides back and the yellow div hides. You can open and close the portfolio div as often as you like and it works a treat. If you try doing the same in safari, it works the first time but then it starts pushing the black div down. I cant for the life of me think what it could be and I have spent ages on it. If one of you kind experts on here could have a quick look at it for me I would more grateful than you can imagine! Thanks in advance, Maffo
[jQuery] Re: can all jQuery code be included in just one $(function(){}); ?
Excellent, thanks! On 10 Aug., 15:56, amuhlou amysch...@gmail.com wrote: According to the API, you can have as many $(function(){}); in a page as you'd like.http://docs.jquery.com/Events/ready It just depends on the needs of your project. If it's imperative that $ (#myrandomdiv).corner(7px) is applied after $(.myboxclass).corner (7px); completes, then leave them separate as in your second example. On Aug 10, 6:15 am, Jesper F jesperfjoel...@gmail.com wrote: I Include my javascript in an includefile. Which is better way to organize the jQuery code: $(function(){ $(.myboxclass).corner(7px); $(#myrandomdiv).corner(7px); }); or $(function(){ $(.myboxclass).corner(7px); }); $(function(){ $(#myrandomdiv).corner(7px); }); that is in two sections. Is the last just wasting space? they seem to be working the same. Thanks.
[jQuery] Jquery Game : Outer Empires : Open Beta
Well, we've finally entered the open beta phase of Outer Empires (http://www.outer-empires.com) which is a game that is built using a lot of Jquery... :) If you fancy having a go, head on over to the site to get started (the main news item will give you all the information you need) - it'll show you a bit about what Jquery can do when coerced into playing ball. (And a bit more information : ) Outer Empires (http://www.outer-empires.com ) is a space based game combining the game play of Elite (market trading, modding of your ships in a seemingly endless galaxy), Sins of a solar empire (colonisation of planets/moons and production of items to aid you or your faction) and EvE (what space mmo couldn't be compared to EvE?). It's a full MMO - with a sandpit type gameplay, we don't force people to do any particular job or role in game it's up to them to find their own way (although there are some pointers for people at the beginning). One of the differences between this MMO and others is that it's cross platform, those on the browser can interact with those in the iPhone and vice versa. That and it's a real MMO for the iphone instead of an imobster clone. For reference, however, the iPhone version is a proper native app, NOT using Jquery in any way, except for the in game galaxy viewer. If you have any questions or comments, either leave them here, or post them up in the newbie channel in game and I'll reply in there. See you soon, Paul Hutson (ala, Thoras Agea, in game) Lead Developer Outer Empires.
[jQuery] Re: Jquery Game : Outer Empires : Open Beta
p.s. Sorry if I put this in the wrong place!! I didn't know where else to post it...!
[jQuery] Using ScrollTo, IE displays hidden info bef ore it hides it — Any help/ideas?
Hi there, I'm nearly done with this client site, and it works well in all the browsers I've checked, but I'd really like to finetune the performance in IE. http://maximizeutility.com/what/ I know that the video embedding doesn't validate, but it's the best solution I've found that allows the videos to play on iPhones and desktops. Do you have any idea how to have the hidden video viewers hidden upon page load in IE? It's performing on Mac Safari FF, and Windows FF, but in Windows IE it's a lot slower to hide the info. Many thanks! Jen
[jQuery] load() event on a link tag?
Hello, When a user clicks a button I dynamically load large CSS and JS files. I handle it in this way: $(#say_hello).click(function() { $(body).prepend('link type=text/css rel=stylesheet id=example href=css/jquery-ui.min.css /'); $.getScript(js/mail.js); $(#say_hello_box).dialog(open); }); It works great, but the problem is that sometimes the dialog box opens before the CSS has loaded. I would like to add the equivalent of $ (#example).load(), since using load() does not seem to work. Can anyone recommend a way to do this? Thanks for the help.
[jQuery] Re: load() event on a link tag?
You could dialog box in the callback of the click funciton... $(#say_hello).click( function() { $(body).prepend('link type=text/css rel=stylesheet id=example href=css/jquery-ui.min.css /'); $.getScript(js/mail.js); $(#say_hello_box).dialog(open); }); On Mon, Aug 10, 2009 at 12:51 PM, ebakunin ebaku...@gmail.com wrote: Hello, When a user clicks a button I dynamically load large CSS and JS files. I handle it in this way: $(#say_hello).click(function() { $(body).prepend('link type=text/css rel=stylesheet id=example href=css/jquery-ui.min.css /'); $.getScript(js/mail.js); $(#say_hello_box).dialog(open); }); It works great, but the problem is that sometimes the dialog box opens before the CSS has loaded. I would like to add the equivalent of $ (#example).load(), since using load() does not seem to work. Can anyone recommend a way to do this? Thanks for the help. -- Regards! Alexander Freiria - Programmer\Web Developer http://www.xandercs.com/ xanderco...@gmail.com 954.549.3666
[jQuery] Re: Cleartype issues with jquery/superfish in IE8
I'm having this issue with IE8 as well and my implementation of Superfish menu. Anyone know of a fix? -Roman
[jQuery] Full jQuery website
Hi everybody, Is there any project about a website using pure jQuery for rendering the pages ? Thanks, Cyril
[jQuery] Re: load() event on a link tag?
Unfortunately the callback on click() never occurs: $(#say_hello).click(function() { $(body).prepend('link type=text/css rel=stylesheet href=css/ jquery-ui.min.css /') $.getScript(js/mail.js); }, function() { alert(done); }); As a hack, I can attach the event to the getScript() callback, since it takes roughly the same time to load as the stylesheet: $(#say_hello).click(function() { $(body).prepend('link type=text/css rel=stylesheet href=css/? php echo Page::JQUERY_UI_CSS; ? /') $.getScript(js/mail.js, function() { $(#say_hello_box).dialog(open); }); }); This still doesn't address the original problem, though. Any other ideas? (I really do appreciate the help, Alex) On Aug 10, 10:04 am, Alexander Freiria xanderco...@gmail.com wrote: You could dialog box in the callback of the click funciton... $(#say_hello).click( function() { $(body).prepend('link type=text/css rel=stylesheet id=example href=css/jquery-ui.min.css /'); $.getScript(js/mail.js); $(#say_hello_box).dialog(open); }); On Mon, Aug 10, 2009 at 12:51 PM, ebakunin ebaku...@gmail.com wrote: Hello, When a user clicks a button I dynamically load large CSS and JS files. I handle it in this way: $(#say_hello).click(function() { $(body).prepend('link type=text/css rel=stylesheet id=example href=css/jquery-ui.min.css /'); $.getScript(js/mail.js); $(#say_hello_box).dialog(open); }); It works great, but the problem is that sometimes the dialog box opens before the CSS has loaded. I would like to add the equivalent of $ (#example).load(), since using load() does not seem to work. Can anyone recommend a way to do this? Thanks for the help. -- Regards! Alexander Freiria - Programmer\Web Developerhttp://www.xandercs.com/ xanderco...@gmail.com 954.549.3666
[jQuery] Re: load() event on a link tag?
try setTimeOut On Mon, Aug 10, 2009 at 1:28 PM, ebakunin ebaku...@gmail.com wrote: Unfortunately the callback on click() never occurs: $(#say_hello).click(function() { $(body).prepend('link type=text/css rel=stylesheet href=css/ jquery-ui.min.css /') $.getScript(js/mail.js); }, function() { alert(done); }); As a hack, I can attach the event to the getScript() callback, since it takes roughly the same time to load as the stylesheet: $(#say_hello).click(function() { $(body).prepend('link type=text/css rel=stylesheet href=css/? php echo Page::JQUERY_UI_CSS; ? /') $.getScript(js/mail.js, function() { $(#say_hello_box).dialog(open); }); }); This still doesn't address the original problem, though. Any other ideas? (I really do appreciate the help, Alex) On Aug 10, 10:04 am, Alexander Freiria xanderco...@gmail.com wrote: You could dialog box in the callback of the click funciton... $(#say_hello).click( function() { $(body).prepend('link type=text/css rel=stylesheet id=example href=css/jquery-ui.min.css /'); $.getScript(js/mail.js); $(#say_hello_box).dialog(open); }); On Mon, Aug 10, 2009 at 12:51 PM, ebakunin ebaku...@gmail.com wrote: Hello, When a user clicks a button I dynamically load large CSS and JS files. I handle it in this way: $(#say_hello).click(function() { $(body).prepend('link type=text/css rel=stylesheet id=example href=css/jquery-ui.min.css /'); $.getScript(js/mail.js); $(#say_hello_box).dialog(open); }); It works great, but the problem is that sometimes the dialog box opens before the CSS has loaded. I would like to add the equivalent of $ (#example).load(), since using load() does not seem to work. Can anyone recommend a way to do this? Thanks for the help. -- Regards! Alexander Freiria - Programmer\Web Developerhttp://www.xandercs.com/ xanderco...@gmail.com 954.549.3666 -- Regards! Alexander Freiria - Programmer\Web Developer http://www.xandercs.com/ xanderco...@gmail.com 954.549.3666
[jQuery] Re: Full jQuery website
Is there any project about a website using pure jQuery for rendering the pages ? When you say pure jquery, what exactly do you mean? Outer Empires uses Jquery for a LOT of the positioning, animation, etc when in game (http://www.outer-empires.com) - the front page uses a little as well now I think about it.
[jQuery] Re: refactoring help/ suggestions?
Here is a solution I came up with, but there is still some repeated code. Does anyone have any suggestions I could try out to 'DRY' up my code? jQuery.fn.swapFade = function() { if (this.is(':hidden')) { this.fadeIn('slow'); } else { this.fadeOut('slow'); } }; $(document).ready(function() { $('p.a, p.b, p.c').hide(); var hash = {'one': 'a', 'two': 'b', 'three': 'c'} $('.one').hover(function() { $('a.one').fadeOut('slow').fadeIn('slow'); $('p.' + hash[this.className]).swapFade(); return false; }); $('.two').hover(function() { $('a.two').fadeOut('slow').fadeIn('slow'); $('p.' + hash[this.className]).swapFade(); return false; }); $('.three').hover(function() { $('a.three').fadeOut('slow').fadeIn('slow'); $('p.' + hash[this.className]).swapFade(); return false; }); }); On Aug 9, 11:51 am, Calvin cstephe...@gmail.com wrote: Hi, I wrote this code for a simple hide and show effect and I am looking for any advice or examples of how I can refactor the code. I tried using a hash but it didn't work out right and I am thinking that maybe I should make a object method. here is the code: $(document).ready(function() { var $firstPara = $('p.a'); $firstPara.hide(); $('a.one').hover(function() { $('a.one').fadeOut('slow').fadeIn('slow'); if ($firstPara.is(':hidden')) { $firstPara.fadeIn('slow'); } else { $firstPara.fadeOut('slow'); } return false; }); }); $(document).ready(function() { var $secondPara = $('p.b'); $secondPara.hide(); $('a.two').hover(function() { $('a.two').fadeOut('slow').fadeIn('slow'); if ($secondPara.is(':hidden')) { $secondPara.fadeIn('slow'); } else { $secondPara.fadeOut('slow'); } return false; }); }); $(document).ready(function() { var $thirdPara = $('p.c'); $thirdPara.hide(); $('a.three').hover(function() { $('a.three').fadeOut('slow').fadeIn('slow'); if ($thirdPara.is(':hidden')) { $thirdPara.fadeIn('slow'); } else { $thirdPara.fadeOut('slow'); } return false; }); });
[jQuery] Select Option add Class
This might have been resolved, but I can't find a solution with my search. I'm trying to add a class with the text of the option. Simple to do the selected option, but not all of them it seems. I want to change: select class=required id=custom1 name=custom1 option selected= value=/ option value=1Text 1/option option value=2Text 2/option option value=3Text 3/option /select to: select class=required id=custom1 name=custom1 option selected= value=/ option value=1 class=Text 1Text 1/option option value=2 class=Text 2Text 2/option option value=3 class=Text 3Text 3/option /select I have tried $('#selectList :selected').text() and $.map($ ('#foo :selected'), function(e) { return $(e).text(); }) but to no avail... I feel like I'm missing something
[jQuery] Re: Select Option add Class
You can achieve this with a loop using the each method: $('select#custom1 option').each(function(){ var theText = $(this).html(); $(this).addClass(theText); }); However, with your current HTML, the class names will have spaces in them, which isn't valid. On Aug 10, 1:52 pm, Benn bennmey...@gmail.com wrote: This might have been resolved, but I can't find a solution with my search. I'm trying to add a class with the text of the option. Simple to do the selected option, but not all of them it seems. I want to change: select class=required id=custom1 name=custom1 option selected= value=/ option value=1Text 1/option option value=2Text 2/option option value=3Text 3/option /select to: select class=required id=custom1 name=custom1 option selected= value=/ option value=1 class=Text 1Text 1/option option value=2 class=Text 2Text 2/option option value=3 class=Text 3Text 3/option /select I have tried $('#selectList :selected').text() and $.map($ ('#foo :selected'), function(e) { return $(e).text(); }) but to no avail... I feel like I'm missing something
[jQuery] Get the ID of a button that is clicked
I have a listing of records on a page and an Edit button for each record. I want to write some jquery that fires when the button is clicked to go to the edit page for the record whose button I clicked. Here is what I have. Feel free to tel lme to do it completely differently if there is an easier way. THANKS! script type=text/javascript $(function() { $('#myGroup input:button').click(function(e) { self.location = 'foo.cfm?id=' + I NEED TO GET THE ID OF THE BUTTON CLICKED HERE }); }); /script div id=myGroup input type=button id=1 value=Edit input type=button id=2 value=Edit input type=button id=3 value=Edit /div
[jQuery] Re: Get the ID of a button that is clicked
this.id On Mon, Aug 10, 2009 at 11:48 AM, Erich93063 erich93...@gmail.com wrote: I have a listing of records on a page and an Edit button for each record. I want to write some jquery that fires when the button is clicked to go to the edit page for the record whose button I clicked. Here is what I have. Feel free to tel lme to do it completely differently if there is an easier way. THANKS! script type=text/javascript $(function() { $('#myGroup input:button').click(function(e) { self.location = 'foo.cfm?id=' + I NEED TO GET THE ID OF THE BUTTON CLICKED HERE }); }); /script div id=myGroup input type=button id=1 value=Edit input type=button id=2 value=Edit input type=button id=3 value=Edit /div -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: Get the ID of a button that is clicked
WOW I thought I tried that. That was my first instinct. I must have had an error somewhere else. That worked. THANKS! On Aug 10, 11:50 am, Charlie Griefer charlie.grie...@gmail.com wrote: this.id On Mon, Aug 10, 2009 at 11:48 AM, Erich93063 erich93...@gmail.com wrote: I have a listing of records on a page and an Edit button for each record. I want to write some jquery that fires when the button is clicked to go to the edit page for the record whose button I clicked. Here is what I have. Feel free to tel lme to do it completely differently if there is an easier way. THANKS! script type=text/javascript $(function() { $('#myGroup input:button').click(function(e) { self.location = 'foo.cfm?id=' + I NEED TO GET THE ID OF THE BUTTON CLICKED HERE }); }); /script div id=myGroup input type=button id=1 value=Edit input type=button id=2 value=Edit input type=button id=3 value=Edit /div -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Validate groups of input fields, checkbox highlight and reset
Hi, I have 3 problems I need to solve: 1. Validate groups of input fields. I see in the example of tabs, you can do as follows: // validate the other two selects when one changes to update the whole group var birthdaySelects = $(#birthdateGroup select).click(function() { birthdaySelects.not(this).valid(); }); However, mine is not using select, but it is using input text field. So I modify the code into: // validate the other two inputs when one changes to update the whole group var birthdayInputs = $(#birthdateGroup input).keyup(function() { birthdayInputs.not(this).valid(); }); However, it is not working with the input fields. Please help to make it works. 2. Checkbox highlight. I am using a class highlight for all the errors. I use required checkbox, so at least 1 checkbox must be checked. If I check the first item, then uncheck, the error message appear and the error class highlight also successfully displayed. However, if I check the second or the third (etc) item, then uncheck, only the error msg appear, the error class doesn't highlight. Here is my code: highlight: function( element, errorClass, validClass ) { $(element).parents('li').addClass(errorClass).removeClass (validClass); }, unhighlight: function( element, errorClass, validClass ) { $(element).parents('li').removeClass(errorClass).addClass (validClass); }, 3. Reset function not working. Here is my code: var v = $('.myForm').validate({ bla... bla ... bla}); $('#resetButton').click(function() { v.resetForm(); }); I figure this is caused by I am using a highlight class (see item 2 above). Please help me to find the solution for this. I am still learning Jquery, but I do find it very useful. THanks in advance for all the help.
[jQuery] Re: Regular Expression validation
jQuery.validator.addMethod(notNumber, function(value, element, param) { var reg = /[0-9]/; if(reg.test(value)){ return false; }else{ return true; } }, Number is not permitted); Eduardo Pinzon Web Developer 2009/8/10 nouky a.noor...@gmail.com What I really wanted to do is use the jQuery validator and in the function set a validation that numbers are not allowed in a text input. For example I have this code: $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#signupform).validate({ rules: { firstname: required, lastname: required, username: { required: true, minlength: 2, remote: users.php } } }); }); How do I set the validation that no number are allowed in the firstname text box On Aug 10, 8:52 am, nouky a.noor...@gmail.com wrote: I'm not that good with javascript. If the textboxt name is txtname, how do you incorporate it in the code above???
[jQuery] Re: Select Option add Class
try this: $(#custom1 option).each(function(){ var class = $(this).html(); addClass(class); }); Eduardo Pinzon Web Developer 2009/8/10 Benn bennmey...@gmail.com This might have been resolved, but I can't find a solution with my search. I'm trying to add a class with the text of the option. Simple to do the selected option, but not all of them it seems. I want to change: select class=required id=custom1 name=custom1 option selected= value=/ option value=1Text 1/option option value=2Text 2/option option value=3Text 3/option /select to: select class=required id=custom1 name=custom1 option selected= value=/ option value=1 class=Text 1Text 1/option option value=2 class=Text 2Text 2/option option value=3 class=Text 3Text 3/option /select I have tried $('#selectList :selected').text() and $.map($ ('#foo :selected'), function(e) { return $(e).text(); }) but to no avail... I feel like I'm missing something
[jQuery] Re: Get the ID of a button that is clicked
or script type=text/javascript $(function() { $('#myGroup input:button').click(function(e) { self.location = 'foo.cfm?id=' + $(this).attr(id); }); }); /script 2009/8/10 Erich93063 erich93...@gmail.com WOW I thought I tried that. That was my first instinct. I must have had an error somewhere else. That worked. THANKS! On Aug 10, 11:50 am, Charlie Griefer charlie.grie...@gmail.com wrote: this.id On Mon, Aug 10, 2009 at 11:48 AM, Erich93063 erich93...@gmail.com wrote: I have a listing of records on a page and an Edit button for each record. I want to write some jquery that fires when the button is clicked to go to the edit page for the record whose button I clicked. Here is what I have. Feel free to tel lme to do it completely differently if there is an easier way. THANKS! script type=text/javascript $(function() { $('#myGroup input:button').click(function(e) { self.location = 'foo.cfm?id=' + I NEED TO GET THE ID OF THE BUTTON CLICKED HERE }); }); /script div id=myGroup input type=button id=1 value=Edit input type=button id=2 value=Edit input type=button id=3 value=Edit /div -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: $ajax() problem
If the type is POST you could set arguments by 'data', or set the type to GET to pass the paraments in querystring ... type: GET, url: mywebpage.aspx?Arg=+args2, ... OR ... type: POST, url: mywebpage.aspx, data:{Arg:args2} ... Eduardo Pinzon Web Developer 2009/8/10 yi falconh...@gmail.com $.ajax({ type: POST, url: mywebpage.aspx?Arg=+args2, contentType: text, data:{}, dataType: text, success: CompleteInsert, error: onFail }); I dont know why the onFail function is going to be executed when args2 is too big. args2 is a string type can anyone explain this thanks
[jQuery] Re: jQuery validation - Numbers not allowed
try create this method jQuery.validator.addMethod(notNumber, function(value, element, param) { var reg = /[0-9]/; if(reg.test(value)){ return false; }else{ return true; } }, Number is not permitted); $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#signupform).validate({ rules: { firstname: {required:true,notNumber:true}, lastname: required, username: { required: true, minlength: 2, remote: users.php } } }); }); Eduardo Pinzon Web Developer
[jQuery] Re: BlockUI overlapping issue with element negative margin
Hi Mike, I just found out that exactly this behavior (changing the display from static to relative) messes up my page too, only in IE: a known issue with the IE's z-index stacks (well described at http://mahzeh.org/?p=19). Could you consider, if possible, reverting the blocking element's display attribute back to static after unblocking? Thanks a ton in advance, snobo On Jun 19, 7:36 pm, Mike Alsup mal...@gmail.com wrote: Yes it is modified, because the div itself (not the blocking overlay) comes over the ul/li elements when calling blockUI on it. To clarify, the zIndex of the div is not modified. The only thing modified on the blocked element (the div in your case) is the position style, and only if it is currently 'static'. The position is set the 'relative' so that the overlay can be absolutely positioned within. Mike
[jQuery] Problem on IE8
I found 2 problems when I use jQuery on IE8 1. When I use $('elementId').css('border-top-width'), it return medium, but other browsers return 0px 2. After domready, my page, that's a widget, call ajax to load content. On page, it have menu link to call ajax to load value. I debug and found no any response from ajax call. Anyone have suggestion?
[jQuery] listmenu
This may not be a bug in the jQuery List menu widget but if it saves someone the time it took me to figure it out or the author has an idea of how to handle this then it is worth it. If the items begin with a comma - , Paul - it causes the columns in the result to not be created in IE 7 and the results just show straight down. In Chrome, Firefox 3.5 and the latest Safari the results do not show at all. I spent a couple of hours tracking this down and I just cleaned up the data that I was playing with. Maybe the widget can strip off leading characters that are not letters or numbers. Great widget though! Paul Speranza
[jQuery] Re: can all jQuery code be included in just one $(function(){}); ?
The former is better On 8/10/09, Jesper F jesperfjoel...@gmail.com wrote: I Include my javascript in an includefile. Which is better way to organize the jQuery code: $(function(){ $(.myboxclass).corner(7px); $(#myrandomdiv).corner(7px); }); or $(function(){ $(.myboxclass).corner(7px); }); $(function(){ $(#myrandomdiv).corner(7px); }); that is in two sections. Is the last just wasting space? they seem to be working the same. Thanks. -- Toshiya TSURU turutos...@gmail.com http://www.google.com/profiles/turutosiya
[jQuery] Re: jQuery Cycle Plugin and Links
Hi there, I am having a similar issue, but the functionality I want to achieve is a bit simpler. Right now I want to apply a link of my choosing to each slide (in the HTML of the slide), but t this breaks the alt information pulled from the the pager and displays an undefined error on the page. I don't quite know how to achieve this in the code. This is a snippet of my pager code: .after('div id=nav') pager:'#nav', pagerAnchorBuilder: function(idx, slide) { var navlabel = $($(slide).html() +'img').attr('alt'); return 'spana href=#' + navlabel + '/a/span'; } } This is my current jQuery cycle HTML Code for each slide: div class=cycler div id=rotator !-- slide 1 -- div class=slideimg src=image1.jpg width=400 height=120 alt=Alt Text for Pager / div class=caption h1a href=link-to-page.htmlTitle Headline/a/h1 pCaption Text and other HTML/p /div/div !-- /slide 1-- !-- slide 2 -- Same code as above but different image and caption content !-- /slide 2 -- /div /div I want to manually add a custom href around the slide image src (like the example code below) but it completely breaks it the pager navigation and shows undefined error: !-- slide -- div class=slide 1 a href =custom-link.htmlimg src=image.jpg width=400 height=120 alt=Alt Text for Pager //a div class=caption h1a href=link-to-page.htmlTitle Headline/a/h1 pCaption Text and other HTML/p /div/div !-- /slide 1 -- How can I do this? Many thanks, Danielle On Jul 22, 8:35 am, Charlie charlie...@gmail.com wrote: the details you want to display can also be contained elsewhere if you want by using the index of the current slide to match the index of another set of containers function onAfter(curr, next, opts) { var index = opts.currSlide; // use index to refernece other containers to work with } thus you can hide a series of containers and display the ones you want on each slide. Also can use the onBefore to hide, animate or whatever to remove the info showing , let new slide show up, then add new info with onAfter Mescalero wrote:Thanks guys, Using that, this is what i have: $(function() { $('#slides').before('div id=nav class=nav').cycle({ fx: 'fade', speed: 'fast', timeout: 0, pager: '#nav', after: onAfter }); }); function onAfter() { $('#article-description').html(h3 + this.title + / h3) .append('p' + this.alt + ' a href=' + this.link +'Read more ›/p'); } and then in the body i have something like: img name= src=images/features/botanical.jpg width=388 height=218 title=Botanical Garden alt=Almost 300 acres, the botanical garden has miles of streams and nature trails, display gardens, and flowers and plants. link=http://www.scbg.com/ the only problem is that this.link is coming up undefined. I am curious where i need to define it so that it will pick up the link attribute like it does src and title. If i just put the link in the unused 'name attribute and change to + this.name it also works, but that i may want other attributes later down the road...does this make sense? Matt On Jul 20, 7:07 pm, Mike Alsupmal...@gmail.comwrote:I would like to add another attribute to the img tag called link.This attribute would define where theimagewould link to if someone clicks theimage.Then i could do something like: .append('p' + this.alt + ' a href=' + this.link +'Read more ›/p');Does anyone know what/where i can add in thecyclejs to accomodate for this.link?Check out the 'callbacks' example on this page:http://www.malsup.com/jquery/cycle/int2.html
[jQuery] Two Menus Showing up
I installed the Superfish Module and all appears to be working properly, My question is The Original Horizontal Nav is still showing up? How do I Disable? Also, The links with drop down's are gray and the links with no dropdown are red? Thanks, Owen
[jQuery] animate image position
Hi, I'm experiencing a large amount of flickering in a image i move with animate(). Looking at jQuery's source code, i think it has something to do with the setInterval it uses to calculate the animation; when binding the animation to 'mousemove' its runs smoothly. Any ideas on how to improve this animation? Thanks, Tom.
[jQuery] Re: Get the ID of a button that is clicked
Aye, but I've been reprimanded (on this list) for suggesting that (and incurring the 'overhead' of a jQuery object) when 'this' works just fine :) On Mon, Aug 10, 2009 at 11:56 AM, Eduardo Pinzon edcpin...@gmail.comwrote: or script type=text/javascript $(function() { $('#myGroup input:button').click(function(e) { self.location = 'foo.cfm?id=' + $(this).attr(id); }); }); /script 2009/8/10 Erich93063 erich93...@gmail.com WOW I thought I tried that. That was my first instinct. I must have had an error somewhere else. That worked. THANKS! On Aug 10, 11:50 am, Charlie Griefer charlie.grie...@gmail.com wrote: this.id On Mon, Aug 10, 2009 at 11:48 AM, Erich93063 erich93...@gmail.com wrote: I have a listing of records on a page and an Edit button for each record. I want to write some jquery that fires when the button is clicked to go to the edit page for the record whose button I clicked. Here is what I have. Feel free to tel lme to do it completely differently if there is an easier way. THANKS! script type=text/javascript $(function() { $('#myGroup input:button').click(function(e) { self.location = 'foo.cfm?id=' + I NEED TO GET THE ID OF THE BUTTON CLICKED HERE }); }); /script div id=myGroup input type=button id=1 value=Edit input type=button id=2 value=Edit input type=button id=3 value=Edit /div -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: listmenu
Hi Paul, Thanks for this info, I'll add it to my test cases and thanks for letting the community know. I was actually working on a new version of the plugin yesterday, which adds one new feature: an onClick option that you can pass a function to for handling clicks in the dropdown menu. If that's a feature that might be of interest to you I can get you a copy of the pre-release version. I'll look into what you reported. Oh, uh, just to make sure, you're talking about the listmenu plugin, right? http://www.ihwy.com/Labs/jquery-listmenu-plugin.aspx Thanks, Jack Paul Speranza wrote: This may not be a bug in the jQuery List menu widget but if it saves someone the time it took me to figure it out or the author has an idea of how to handle this then it is worth it. If the items begin with a comma - , Paul - it causes the columns in the result to not be created in IE 7 and the results just show straight down. In Chrome, Firefox 3.5 and the latest Safari the results do not show at all. I spent a couple of hours tracking this down and I just cleaned up the data that I was playing with. Maybe the widget can strip off leading characters that are not letters or numbers. Great widget though! Paul Speranza
[jQuery] input has focus
Hello: I'm trying to know if an input has focus. Is that possible using jquery? samething like this: $('input#1').has_focus()
[jQuery] Re: Two Menus Showing up
Forgot to mention I am using Joomla 1.5 On Aug 10, 10:04 am, FlowSnowboards flowsno...@gmail.com wrote: I installed the Superfish Module and all appears to be working properly, My question is The Original Horizontal Nav is still showing up? How do I Disable? Also, The links with drop down's are gray and the links with no dropdown are red? Thanks, Owen
[jQuery] Re: Get the ID of a button that is clicked
Would e.target.id also work in this case? Thanks, Anoop On Mon, Aug 10, 2009 at 3:00 PM, Charlie Griefer charlie.grie...@gmail.comwrote: Aye, but I've been reprimanded (on this list) for suggesting that (and incurring the 'overhead' of a jQuery object) when 'this' works just fine :) On Mon, Aug 10, 2009 at 11:56 AM, Eduardo Pinzon edcpin...@gmail.comwrote: or script type=text/javascript $(function() { $('#myGroup input:button').click(function(e) { self.location = 'foo.cfm?id=' + $(this).attr(id); }); }); /script 2009/8/10 Erich93063 erich93...@gmail.com WOW I thought I tried that. That was my first instinct. I must have had an error somewhere else. That worked. THANKS! On Aug 10, 11:50 am, Charlie Griefer charlie.grie...@gmail.com wrote: this.id On Mon, Aug 10, 2009 at 11:48 AM, Erich93063 erich93...@gmail.com wrote: I have a listing of records on a page and an Edit button for each record. I want to write some jquery that fires when the button is clicked to go to the edit page for the record whose button I clicked. Here is what I have. Feel free to tel lme to do it completely differently if there is an easier way. THANKS! script type=text/javascript $(function() { $('#myGroup input:button').click(function(e) { self.location = 'foo.cfm?id=' + I NEED TO GET THE ID OF THE BUTTON CLICKED HERE }); }); /script div id=myGroup input type=button id=1 value=Edit input type=button id=2 value=Edit input type=button id=3 value=Edit /div -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] [UI 1.7.2] Datepicker: Encapsulated theme?
Hi, For the sake of learning, does anyone know where I could nab a copy of the datepicker CSS that does not have any extra UI css? Basically, I just want to style the datepicker sans extraneous UI css. :) The ui.datepicker.css gets me pretty far, but I appear to be missing some styles. Should that stylesheet give me everything I need, or do I need the whole UI css in order for it to be styled correctly? Thank you! Cheers, M
[jQuery] Re: Get the ID of a button that is clicked
sorry, tanks for tip 2009/8/10 Charlie Griefer charlie.grie...@gmail.com Aye, but I've been reprimanded (on this list) for suggesting that (and incurring the 'overhead' of a jQuery object) when 'this' works just fine :) On Mon, Aug 10, 2009 at 11:56 AM, Eduardo Pinzon edcpin...@gmail.comwrote: or script type=text/javascript $(function() { $('#myGroup input:button').click(function(e) { self.location = 'foo.cfm?id=' + $(this).attr(id); }); }); /script 2009/8/10 Erich93063 erich93...@gmail.com WOW I thought I tried that. That was my first instinct. I must have had an error somewhere else. That worked. THANKS! On Aug 10, 11:50 am, Charlie Griefer charlie.grie...@gmail.com wrote: this.id On Mon, Aug 10, 2009 at 11:48 AM, Erich93063 erich93...@gmail.com wrote: I have a listing of records on a page and an Edit button for each record. I want to write some jquery that fires when the button is clicked to go to the edit page for the record whose button I clicked. Here is what I have. Feel free to tel lme to do it completely differently if there is an easier way. THANKS! script type=text/javascript $(function() { $('#myGroup input:button').click(function(e) { self.location = 'foo.cfm?id=' + I NEED TO GET THE ID OF THE BUTTON CLICKED HERE }); }); /script div id=myGroup input type=button id=1 value=Edit input type=button id=2 value=Edit input type=button id=3 value=Edit /div -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: input has focus
You can add a class to your field when it has focus and then check for the class: $(:input) // add focus/blur events .focus(function (){ $(this).addClass(has-focus); }) .blur(function (){ $(this).removeClass(has-focus); }); Now you can just do $(input#1).is(.has-focus) to check if it has focus. -Dan On Mon, Aug 10, 2009 at 3:20 PM, MartinBorthiry martin.borth...@gmail.comwrote: Hello: I'm trying to know if an input has focus. Is that possible using jquery? samething like this: $('input#1').has_focus()
[jQuery] Re: Problem on IE8
How are you setting the border in CSS ? If you set it explicitly, it should work cross-browser L Gaiz wrote: I found 2 problems when I use jQuery on IE8 1. When I use $('elementId').css('border-top-width'), it return medium, but other browsers return 0px 2. After domready, my page, that's a widget, call ajax to load content. On page, it have menu link to call ajax to load value. I debug and found no any response from ajax call. Anyone have suggestion? No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.392 / Virus Database: 270.13.49/2294 - Release Date: 08/10/09 06:10:00
[jQuery] Re: I need Validation Plugin help... (again)
I found the issue I wasnt using the errorPlacement option. I added this. errorPlacement: function(error, element) { error.appendTo( element.parent() ); }, On Aug 10, 4:17 pm, Miket3 miketro...@gmail.com wrote: This thing has kicked my butt all week long. Yesterday, I actually got it to work.(almost). Since I am new to this plugin, I am using FRANKENSTEIN code built from examples and samples. here is my code: success: function(label) { var valid_img = 'img src=/global_libs/images/ icons/checked.gif'; // set nbsp; as text for IE label.html(valid_img); } My expectation is that I would have a checkmark.gif display next to valid elements. Well...It works. But it works a little too good. Each time I click in and out of the valid field a new label element gets appended and I end up with multiple checkmarks after my field. is this the wrong way to do what I want? The success option came from an example and I have yet to find a reference to it in the documentation. Which brings me to another question... Is there any other place that this documentation is located that is a little more user friendly? The jQuery site is a nice repository for code and plugins, but it really isn't setup for documentation. Especially not for a FULL FEATURE plugin like VALIDATION. And when I say it is not friendly, I mean you cant perform a search on the documentation. Thanks, Mike
[jQuery] Re: input has focus
On 10 ago, 16:49, Dan G. Switzer, II dswit...@pengoworks.com wrote: You can add a class to your field when it has focus and then check for the class: $(:input) // add focus/blur events .focus(function (){ $(this).addClass(has-focus);}) .blur(function (){ $(this).removeClass(has-focus); }); Now you can just do $(input#1).is(.has-focus) to check if it has focus. -Dan Thanks for your reply, but i can't use your method. Because I include the jquery librery on the page's bottom. So, I can't know if input got on focus previosly jquery where initialized.
[jQuery] I need Validation Plugin help... (again)
This thing has kicked my butt all week long. Yesterday, I actually got it to work.(almost). Since I am new to this plugin, I am using FRANKENSTEIN code built from examples and samples. here is my code: success: function(label) { var valid_img = 'img src=/global_libs/images/ icons/checked.gif'; // set nbsp; as text for IE label.html(valid_img); } My expectation is that I would have a checkmark.gif display next to valid elements. Well...It works. But it works a little too good. Each time I click in and out of the valid field a new label element gets appended and I end up with multiple checkmarks after my field. is this the wrong way to do what I want? The success option came from an example and I have yet to find a reference to it in the documentation. Which brings me to another question... Is there any other place that this documentation is located that is a little more user friendly? The jQuery site is a nice repository for code and plugins, but it really isn't setup for documentation. Especially not for a FULL FEATURE plugin like VALIDATION. And when I say it is not friendly, I mean you cant perform a search on the documentation. Thanks, Mike
[jQuery] Re: animate image position
Hi, Can you post an example of your animation code or link to a demo page. Paul On Aug 10, 4:39 pm, Tom Cool tomcoo...@gmail.com wrote: Hi, I'm experiencing a large amount of flickering in a image i move with animate(). Looking at jQuery's source code, i think it has something to do with the setInterval it uses to calculate the animation; when binding the animation to 'mousemove' its runs smoothly. Any ideas on how to improve this animation? Thanks, Tom.
[jQuery] Re: Select Option add Class
this worked great! thank you muchly! On Aug 10, 11:19 am, Eduardo Pinzon edcpin...@gmail.com wrote: try this: $(#custom1 option).each(function(){ var class = $(this).html(); addClass(class); }); Eduardo Pinzon Web Developer 2009/8/10 Benn bennmey...@gmail.com This might have been resolved, but I can't find a solution with my search. I'm trying to add a class with the text of the option. Simple to do the selected option, but not all of them it seems. I want to change: select class=required id=custom1 name=custom1 option selected= value=/ option value=1Text 1/option option value=2Text 2/option option value=3Text 3/option /select to: select class=required id=custom1 name=custom1 option selected= value=/ option value=1 class=Text 1Text 1/option option value=2 class=Text 2Text 2/option option value=3 class=Text 3Text 3/option /select I have tried $('#selectList :selected').text() and $.map($ ('#foo :selected'), function(e) { return $(e).text(); }) but to no avail... I feel like I'm missing something
[jQuery] Re: Full jQuery website
On Aug 10, 7:19 pm, Cyril dubus...@gmail.com wrote: Is there any project about a website using pure jQuery for rendering the pages ? It's funny you mention that, because i'm working on exactly that right now: an application framework for writing apps in pure JS, using HTML only to get the JS and CSS loaded, and maybe set up the overall layout using well-defined element IDs for various parts of the UI, e.g. #ContentArea and #PageHeader. By pure JS i mean basically pure JS, but based around jQuery (in fact i call it jqApp). i've got a demo here: http://wanderinghorse.net/computing/javascript/jquery/jqapp/demo.html but it doesn't do all that much at the moment (or at least there's not much to *see* at the moment). The most import part currently implemented is a generic message-passing mechanism (demonstrated above) for posting requests and getting responses using a well-defined (but exceedingly simple) JSON grammar. The framework takes care of most of the details, leaving the client to just populate the request and fetch the payload from the response. The above link demonstrates various message types, and gives a good idea of what direction i'm planning on taking that.
[jQuery] Re: jquery + cycle + IE
http://negativespace.ca/clients/mirrorbuilder/ snip/ Works fine in Safari and Firefox so far, but for whatever reason, both of those controllers will not show up in IE6 or IE7. I am a little bit stumped. Just looked in IE7 - looks good to me. Did you fix it?
[jQuery] Re: input has focus
You can still use the same technique but just not use jQuery to do it. On Aug 10, 10:09 am, MartinBorthiry martin.borth...@gmail.com wrote: On 10 ago, 16:49, Dan G. Switzer, II dswit...@pengoworks.com wrote: You can add a class to your field when it has focus and then check for the class: $(:input) // add focus/blur events .focus(function (){ $(this).addClass(has-focus);}) .blur(function (){ $(this).removeClass(has-focus); }); Now you can just do $(input#1).is(.has-focus) to check if it has focus. -Dan Thanks for your reply, but i can't use your method. Because I include the jquery librery on the page's bottom. So, I can't know if input got on focus previosly jquery where initialized.
[jQuery] Re: AJAX and JSON
On Aug 10, 9:58 pm, Joey Derrico joeyd...@gmail.com wrote: I am a novice at AJAX and JSON (Ok, I am a novice at JavaScript.), and I am brand new to jQuery. I wanted to use JSON in a project I am working on and I read various tutorials on using JSON with jQuery however none of them answered some of my questions. The biggest one is, does jQuery support JSON or do I need to use another JSON library to use JSON with jQuery? JSON is simply a data format. Supporting JSON simply means having: a) a function which can transform JS objects into a JSON-compliant string. b) a function which can transform a compliant string into a JS object. AFAIK, jQuery doesn't have any built-in support for JSON, but it doesn't have to - it doesn't operate at a level where JSON would be useful (except for possible selector-style traversal of a JSON tree). The canonical JSON implementation for JavaScript is Doug Crockford's json2.js, available here: http://www.json.org/ See JSON.stringify() and JSON.parse().
[jQuery] Ajax and LiveQuery
Hi ! I use the plugin live query, i have checked many times my code but it dont works, i want to use jquery after an Ajax request. Here is my code : $('#refresh_inventaire').livequery('click',function(){ajax_storage ();}); When I click on the refresh link, it does refresh (using ajax_storage (); function) but the jquery part still dont work... (the jquery script (a simple hide/show) works great without using ajax...) I hope someone can help me, Bye ! (Sorry if I have make some mistakes, I am not english)
[jQuery] AJAX and JSON
I am a novice at AJAX and JSON (Ok, I am a novice at JavaScript.), and I am brand new to jQuery. I wanted to use JSON in a project I am working on and I read various tutorials on using JSON with jQuery however none of them answered some of my questions. The biggest one is, does jQuery support JSON or do I need to use another JSON library to use JSON with jQuery? Joey
[jQuery] Re: Using ScrollTo, IE displays hidden info before it hides it — Any help/ideas?
On Aug 10, 6:26 pm, jen timeyout...@gmail.com wrote: Do you have any idea how to have the hidden video viewers hidden upon page load in IE? It's performing on Mac Safari FF, and Windows FF, but in Windows IE it's a lot slower to hide the info. You could try setting an explicit visibility on the element: div style='visibility:hidden'.../div then they'll start hidden. And if they don't, it's time to ditch IE.
[jQuery] Re: BlockUI overlapping issue with element negative margin
Could you consider, if possible, reverting the blocking element's display attribute back to static after unblocking? The plugin already does that.
[jQuery] Re: VALIDATION not validating when submit button clicked....
Please show the rest of your code. Jörn On Mon, Aug 10, 2009 at 11:49 PM, Miket3miketro...@gmail.com wrote: Here is my handler: submitHandler: function(form) { alert('I CANT GET THIS TO TRIGGER'); }, Here is my button: input class=submit type=submit id=register value=Register How do i trigger a validate when the submit button is clicked? All of my validations work while I am working with the form but the button does zilch.
[jQuery] Re: AJAX and JSON
From: Joey Derrico I am a novice at AJAX and JSON (Ok, I am a novice at JavaScript.), and I am brand new to jQuery. I wanted to use JSON in a project I am working on and I read various tutorials on using JSON with jQuery however none of them answered some of my questions. The biggest one is, does jQuery support JSON or do I need to use another JSON library to use JSON with jQuery? From: Stephan Beal JSON is simply a data format. Supporting JSON simply means having: a) a function which can transform JS objects into a JSON-compliant string. b) a function which can transform a compliant string into a JS object. AFAIK, jQuery doesn't have any built-in support for JSON, but it doesn't have to - it doesn't operate at a level where JSON would be useful (except for possible selector-style traversal of a JSON tree). The canonical JSON implementation for JavaScript is Doug Crockford's json2.js, available here: http://www.json.org/ See JSON.stringify() and JSON.parse(). Actually, jQuery does provide quite a bit of built-in JSON support, and for a large category of apps, it provides all the support you need. If you want to make GET or POST requests to a server, get JSON data back, and use that data in your JavaScript code, you don't need json2.js. jQuery supports all of that, both for JSON data on your own server or JSONP data coming from other domains. Just use $.getJSON() or $.ajax() with the 'json' or 'jsonp' dataType as needed. If you want to *generate* JSON in your JavaScript code (e.g. if your server expects you to send it JSON data in a POST), JSON.stringify() from json2.js is the way to do it. If you want a safer JSON parser instead of the eval-ing JSON parser that jQuery uses, then JSON.parse() from json2.js will give you that. But for most apps you don't need this (and it's less useful than it might sound). Otherwise, you can just use the JSON support in jQuery. -Mike
[jQuery] VALIDATION not validating when submit button clicked....
Here is my handler: submitHandler: function(form) { alert('I CANT GET THIS TO TRIGGER'); }, Here is my button: input class=submit type=submit id=register value=Register How do i trigger a validate when the submit button is clicked? All of my validations work while I am working with the form but the button does zilch.
[jQuery] $ajax() question
$.ajax({ type: POST, url: mywebpage.aspx? Arg=+args2, contentType: text, data:{}, dataType: text, success: CompleteInsert, error: onFail }); I dont know why the onFail function is going to be executed when args2 is too big. args2 is a string type can anyone explain this thanks
[jQuery] Re: $ajax() question
There is a limit on url length depending on the browser. http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/get/url-parameters.html use type:POST and data: instead and do not enclose the object declaration data:{Arg:args2} instead of data:{Arg:args2} On Aug 11, 8:41 am, yi falconh...@gmail.com wrote: $.ajax({ type: POST, url: mywebpage.aspx? Arg=+args2, contentType: text, data:{}, dataType: text, success: CompleteInsert, error: onFail }); I dont know why the onFail function is going to be executed when args2 is too big. args2 is a string type can anyone explain this thanks
[jQuery] Re: VALIDATION not validating when submit button clicked....
Here it is minus the submit handler var v = $(#myform).validate({ rules: { username: {required: true, minlength: 4, remote: {url:lookup.php, type : post, data: {table:members, failmsg:true, successmsg:false, key:username, value:function(){return $(#username).val (); } } } }, password: {required: true, minlength: 5 }, email: {required: true, email: true }, zipcode: {required: true, minlength: 5 }, phone: { phoneUS: true }, cellphone: { phoneUS: true }, fax: { phoneUS: true }, }, //end of rules messages: { username: { required: brEnter a username, minlength: jQuery.format(brEnter at least {0} characters), remote : jQuery.format(brSorry... {0} is already taken.), }, password: { required: Provide a password, rangelength: jQuery.format(Enter at least {0} characters) }, email: { required: Please enter a valid email address, minlength: Please enter a valid email address } }, //end of messages // the errorPlacement has to take the table layout into account errorPlacement: function(error, element) { if ( element.is(:radio) ) error.appendTo( element.parent().next().next() ); else if ( element.is(:checkbox) ) error.appendTo ( element.next() ); else error.appendTo( element.parent() ); }, //end of errorPlacement // set this class to error-labels to indicate valid fields success: function(label) { var valid_img = 'img src=/global_libs/images/icons/ checked.gif'; // set nbsp; as text for IE label.html(valid_img); } // end of success }); On Aug 10, 6:12 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Please show the rest of your code. Jörn On Mon, Aug 10, 2009 at 11:49 PM, Miket3miketro...@gmail.com wrote: Here is my handler: submitHandler: function(form) { alert('I CANT GET THIS TO TRIGGER'); }, Here is my button: input class=submit type=submit id=register value=Register How do i trigger a validate when the submit button is clicked? All of my validations work while I am working with the form but the button does zilch.
[jQuery] Re: VALIDATION not validating when submit button clicked....
DO NOT include hidden fields in the plugin data. I had 3 hidden fields that weren't required but they were phoneUS. That must be a no no. I havent thought about the logic behind... but I am moving on to the next problem. and it may have been that i had no messages setup for them. only rules. On Aug 10, 6:56 pm, Miket3 miketro...@gmail.com wrote: Here it is minus the submit handler var v = $(#myform).validate({ rules: { username: {required: true, minlength: 4, remote: {url:lookup.php, type : post, data: {table:members, failmsg:true, successmsg:false, key:username, value:function(){return $(#username).val (); } } } }, password: {required: true, minlength: 5 }, email: {required: true, email: true }, zipcode: {required: true, minlength: 5 }, phone: { phoneUS: true }, cellphone: { phoneUS: true }, fax: { phoneUS: true }, }, //end of rules messages: { username: { required: brEnter a username, minlength: jQuery.format(brEnter at least {0} characters), remote : jQuery.format(brSorry... {0} is already taken.), }, password: { required: Provide a password, rangelength: jQuery.format(Enter at least {0} characters) }, email: { required: Please enter a valid email address, minlength: Please enter a valid email address } }, //end of messages // the errorPlacement has to take the table layout into account errorPlacement: function(error, element) { if ( element.is(:radio) ) error.appendTo( element.parent().next().next() ); else if ( element.is(:checkbox) ) error.appendTo ( element.next() ); else error.appendTo( element.parent() ); }, //end of errorPlacement // set this class to error-labels to indicate valid fields success: function(label) { var valid_img = 'img src=/global_libs/images/icons/ checked.gif'; // set nbsp; as text for IE label.html(valid_img); } // end of success }); On Aug 10, 6:12 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Please show the rest of your code. Jörn On Mon, Aug 10, 2009 at 11:49 PM, Miket3miketro...@gmail.com wrote: Here is my handler: submitHandler: function(form) { alert('I CANT GET THIS TO TRIGGER'); }, Here is my button: input class=submit type=submit id=register value=Register How do i trigger a validate when the submit button is clicked? All of my validations work while I am working with the form but the button does zilch.
[jQuery] Re: refactoring help/ suggestions?
Assuming your html format as follows: a href=# class=pPara a/a pParagraph a/p br / a href=# class=pPara b/a pParagraph b/p br / a href=# class=pPara c/a pParagraph c/p Use this: $(document).ready(function() { $(a.p).next(p).hide(); $(a.p).hover(function() { $(this).fadeOut(slow).fadeIn(slow); var par = $(this).next(p); if (par.is(:hidden)) par.fadeIn(slow); else par.fadeOut(sloe); }); }); On Aug 11, 3:52 am, Calvin cstephe...@gmail.com wrote: Here is a solution I came up with, but there is still some repeated code. Does anyone have any suggestions I could try out to 'DRY' up my code? jQuery.fn.swapFade = function() { if (this.is(':hidden')) { this.fadeIn('slow'); } else { this.fadeOut('slow'); } }; $(document).ready(function() { $('p.a, p.b, p.c').hide(); var hash = {'one': 'a', 'two': 'b', 'three': 'c'} $('.one').hover(function() { $('a.one').fadeOut('slow').fadeIn('slow'); $('p.' + hash[this.className]).swapFade(); return false; }); $('.two').hover(function() { $('a.two').fadeOut('slow').fadeIn('slow'); $('p.' + hash[this.className]).swapFade(); return false; }); $('.three').hover(function() { $('a.three').fadeOut('slow').fadeIn('slow'); $('p.' + hash[this.className]).swapFade(); return false; }); }); On Aug 9, 11:51 am, Calvin cstephe...@gmail.com wrote: Hi, I wrote this code for a simple hide and show effect and I am looking for any advice or examples of how I can refactor the code. I tried using a hash but it didn't work out right and I am thinking that maybe I should make a object method. here is the code: $(document).ready(function() { var $firstPara = $('p.a'); $firstPara.hide(); $('a.one').hover(function() { $('a.one').fadeOut('slow').fadeIn('slow'); if ($firstPara.is(':hidden')) { $firstPara.fadeIn('slow'); } else { $firstPara.fadeOut('slow'); } return false; }); }); $(document).ready(function() { var $secondPara = $('p.b'); $secondPara.hide(); $('a.two').hover(function() { $('a.two').fadeOut('slow').fadeIn('slow'); if ($secondPara.is(':hidden')) { $secondPara.fadeIn('slow'); } else { $secondPara.fadeOut('slow'); } return false; }); }); $(document).ready(function() { var $thirdPara = $('p.c'); $thirdPara.hide(); $('a.three').hover(function() { $('a.three').fadeOut('slow').fadeIn('slow'); if ($thirdPara.is(':hidden')) { $thirdPara.fadeIn('slow'); } else { $thirdPara.fadeOut('slow'); } return false; }); });