[jQuery] Re: Evaluating json problem
Mike, this was very educative post, thank you very much, it works now. So the bottom line is that ajax call is asynchronous with the code that goes after ajax call (rest of the code is not waitng for the ajax call to finish) and that everything that depends on data returned from ajax call has to go inside $.getJSON(dataURL, function(json) Thanks once again. On Aug 1, 8:45 pm, Michael Geary m...@mg.to wrote: Do you have any debugging tools such as Firebug? You don't have to spend hours on a problem like this, when Firebug can show you the answer instantly. Simply put this line of code before your eval(): console.log( json ); Then look at the Firebug console. You will see that your 'json' variable is not a string. In fact, it is an array object. The $.getJSON() function does the eval() for you, so by the time it calls your callback function, you already have the JSON data as an object (or array, or whatever type the JSON string represents). That's why the error message cites this code: items1=[object Object] Because 'json' is an object, when you write: items1= + json JavaScript converts the 'json' object back into a string, using that generic '[object Object]' format. Since 'json' is already the array object you're looking for, instead of using eval() you can simply do a normal variable assignment: items1 = json; With that fixed, though, I suspect you're about to run into another problem. Reading between the lines, I have a feeling you may be writing code like this: var items1; $.getJSON(dataURL, function(json){ items1 = json; }); // Now do stuff with 'items1' here If so, that won't work. The code where that Now do stuff... comment appears will run *before* the JSON data is downloaded, so the value of 'items1' will be undefined. If you want to do something with the JSON data, you need to do it by calling a function at the time that the $.getJSON callback is called: $.getJSON(dataURL, function(json){ doStuff( json ); doSomethingElse( json ); andMoreStuff( json ); }); Indeed, that's why $.getJSON uses a callback function in the first place - because that's the only to insure that the JSON data is ready when that code is run. -Mike From: UK Hello, I'm trying to execute simple scenario, from the server side (servlet) I'm returning: out.print([{\type\:\basic\}]); on the client side I have : var dataURL = %=response.encodeURL(request.getContextPath())%/ FetchData; var items1; $.getJSON(dataURL, function(json){ eval(items1=+json); }); FireFox is showing jscript exception in the console: Error: missing ] after element list Source File:http://localhost:10038/wps/PA_1lb791mt//jsp/html/test.jsp Line: 345, Column: 15 Source Code: items1=[object Object] Also tried with, but result was the same : items1 = eval(( + eval(json) + )); Lost several hours trying to solve this but no success. Thanks- Hide quoted text - - Show quoted text -
[jQuery] Re: Tabs: page jumps to top when tab changes
Thanks. I don't know javascript much. Where would i put the return false I have: script type=text/javascript $(function() { $(#tabs).tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 5000); }); /script And i am not using onclick events. I tried using: script type=text/javascript $(document).ready(function(){ $('#tabs div').hide(); $('#tabs div:first').show(); $('#tabs ul li:first').addClass('active'); $('#tabs ul li a').click(function(){ $('#tabs ul li').removeClass('active'); $(this).parent().addClass('active'); var currentTab = $(this).attr('href'); $('#tabs div').hide(); $(currentTab).show(); return false; }); }); /script and that works but i lose the fade effect and am not sure where to put it back in. On Jul 30, 7:33 pm, kalyan Chatterjee kalyan11021...@gmail.com wrote: Just try to write return false on tab click event. On Jul 29, 6:53 pm, chris_huh chris@gmail.com wrote: Thanks but I can't find jquery.history_remote.pack.js. I am using jquery 1.7.1 and the tabs thing that comes with JQuery UI. On Jul 29, 2:25 pm, rupak mandal rupakn...@gmail.com wrote: Hi, if you remove the jquery.history_remote.pack.js then I think it works properly. On Wed, Jul 29, 2009 at 5:50 PM, chris_huh chris@gmail.com wrote: At the moment my page will jump to the top (because of the #) whenever a new tab is clicked or when it automatically rotates to one. Is there a way to stop this, maybe using an onclick event instead of relying on the #tabs links?
[jQuery] Re: Tabs: page jumps to top when tab changes
return false is the standard method and will work no problem :) there is an alternative as well $(document).ready(function(e){ // function becomes function(e) e.preventDefault(); // prevent default behavior and ensure the click is canceled. $('#tabs div').hide(); $('#tabs div:first').show(); $('#tabs ul li:first').addClass('active'); $('#tabs ul li a').click(function(){ $('#tabs ul li').removeClass('active'); $(this).parent().addClass('active'); var currentTab = $(this).attr('href'); $('#tabs div').hide(); $(currentTab).show(); }); }); just curious through if any expert out there can explain the difference between using return false; and e.preventDefault(); On Sun, Aug 2, 2009 at 12:21 PM, chris_huh chris@gmail.com wrote: Thanks. I don't know javascript much. Where would i put the return false I have: script type=text/javascript $(function() { $(#tabs).tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 5000); }); /script And i am not using onclick events. I tried using: script type=text/javascript $(document).ready(function(){ $('#tabs div').hide(); $('#tabs div:first').show(); $('#tabs ul li:first').addClass('active'); $('#tabs ul li a').click(function(){ $('#tabs ul li').removeClass('active'); $(this).parent().addClass('active'); var currentTab = $(this).attr('href'); $('#tabs div').hide(); $(currentTab).show(); return false; }); }); /script and that works but i lose the fade effect and am not sure where to put it back in. On Jul 30, 7:33 pm, kalyan Chatterjee kalyan11021...@gmail.com wrote: Just try to writereturn false on tab click event. On Jul 29, 6:53 pm, chris_huh chris@gmail.com wrote: Thanks but I can't find jquery.history_remote.pack.js. I am using jquery 1.7.1 and the tabs thing that comes with JQuery UI. On Jul 29, 2:25 pm, rupak mandal rupakn...@gmail.com wrote: Hi, if you remove the jquery.history_remote.pack.js then I think it works properly. On Wed, Jul 29, 2009 at 5:50 PM, chris_huh chris@gmail.com wrote: At the moment my page will jump to the top (because of the #) whenever a new tab is clicked or when it automatically rotates to one. Is there a way to stop this, maybe using an onclick event instead of relying on the #tabs links?
[jQuery] Re: Tabs: page jumps to top when tab changes
I tried that and it didn't work. The second code i pasted above works (doesn't jump to top of page) but it loses the fading ability. Where as the first bit of code has the fadign but jumps to the top, i don't know where to put the return false statement in that bit of code to prevent it doing that. On Aug 2, 11:26 am, waseem sabjee waseemsab...@gmail.com wrote: return false is the standard method and will work no problem :) there is an alternative as well $(document).ready(function(e){ // function becomes function(e) e.preventDefault(); // prevent default behavior and ensure the click is canceled. $('#tabs div').hide(); $('#tabs div:first').show(); $('#tabs ul li:first').addClass('active'); $('#tabs ul li a').click(function(){ $('#tabs ul li').removeClass('active'); $(this).parent().addClass('active'); var currentTab = $(this).attr('href'); $('#tabs div').hide(); $(currentTab).show(); }); }); just curious through if any expert out there can explain the difference between using return false; and e.preventDefault(); On Sun, Aug 2, 2009 at 12:21 PM, chris_huh chris@gmail.com wrote: Thanks. I don't know javascript much. Where would i put the return false I have: script type=text/javascript $(function() { $(#tabs).tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 5000); }); /script And i am not using onclick events. I tried using: script type=text/javascript $(document).ready(function(){ $('#tabs div').hide(); $('#tabs div:first').show(); $('#tabs ul li:first').addClass('active'); $('#tabs ul li a').click(function(){ $('#tabs ul li').removeClass('active'); $(this).parent().addClass('active'); var currentTab = $(this).attr('href'); $('#tabs div').hide(); $(currentTab).show(); return false; }); }); /script and that works but i lose the fade effect and am not sure where to put it back in. On Jul 30, 7:33 pm, kalyan Chatterjee kalyan11021...@gmail.com wrote: Just try to write return false on tab click event. On Jul 29, 6:53 pm, chris_huh chris@gmail.com wrote: Thanks but I can't find jquery.history_remote.pack.js. I am using jquery 1.7.1 and the tabs thing that comes with JQuery UI. On Jul 29, 2:25 pm, rupak mandal rupakn...@gmail.com wrote: Hi, if you remove the jquery.history_remote.pack.js then I think it works properly. On Wed, Jul 29, 2009 at 5:50 PM, chris_huh chris@gmail.com wrote: At the moment my page will jump to the top (because of the #) whenever a new tab is clicked or when it automatically rotates to one. Is there a way to stop this, maybe using an onclick event instead of relying on the #tabs links?
[jQuery] Re: Tabs: page jumps to top when tab changes
In the code above you are using hide() instead of fadeOut() etc On Sun, Aug 2, 2009 at 12:42 PM, chris_huh chris@gmail.com wrote: I tried that and it didn't work. The second code i pasted above works (doesn't jump to top of page) but it loses the fading ability. Where as the first bit of code has the fadign but jumps to the top, i don't know where to put the return false statement in that bit of code to prevent it doing that. On Aug 2, 11:26 am, waseem sabjee waseemsab...@gmail.com wrote: return false is the standard method and will work no problem :) there is an alternative as well $(document).ready(function(e){ // function becomes function(e) e.preventDefault(); // prevent default behavior and ensure the click is canceled. $('#tabs div').hide(); $('#tabs div:first').show(); $('#tabs ul li:first').addClass('active'); $('#tabs ul li a').click(function(){ $('#tabs ul li').removeClass('active'); $(this).parent().addClass('active'); var currentTab = $(this).attr('href'); $('#tabs div').hide(); $(currentTab).show(); }); }); just curious through if any expert out there can explain the difference between using return false; and e.preventDefault(); On Sun, Aug 2, 2009 at 12:21 PM, chris_huh chris@gmail.com wrote: Thanks. I don't know javascript much. Where would i put the return false I have: script type=text/javascript $(function() { $(#tabs).tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 5000); }); /script And i am not using onclick events. I tried using: script type=text/javascript $(document).ready(function(){ $('#tabs div').hide(); $('#tabs div:first').show(); $('#tabs ul li:first').addClass('active'); $('#tabs ul li a').click(function(){ $('#tabs ul li').removeClass('active'); $(this).parent().addClass('active'); var currentTab = $(this).attr('href'); $('#tabs div').hide(); $(currentTab).show(); return false; }); }); /script and that works but i lose the fade effect and am not sure where to put it back in. On Jul 30, 7:33 pm, kalyan Chatterjee kalyan11021...@gmail.com wrote: Just try to writereturn false on tab click event. On Jul 29, 6:53 pm, chris_huh chris@gmail.com wrote: Thanks but I can't find jquery.history_remote.pack.js. I am using jquery 1.7.1 and the tabs thing that comes with JQuery UI. On Jul 29, 2:25 pm, rupak mandal rupakn...@gmail.com wrote: Hi, if you remove the jquery.history_remote.pack.js then I think it works properly. On Wed, Jul 29, 2009 at 5:50 PM, chris_huh chris@gmail.com wrote: At the moment my page will jump to the top (because of the #) whenever a new tab is clicked or when it automatically rotates to one. Is there a way to stop this, maybe using an onclick event instead of relying on the #tabs links?
[jQuery] Re: Tabs: page jumps to top when tab changes
duh. thanks. but i also realise it is missing the auto rotate thing that could be set up using the tabs function. Is there not a way to use the tabs function with a return false. On Aug 2, 12:27 pm, waseem sabjee waseemsab...@gmail.com wrote: In the code above you are using hide() instead of fadeOut() etc On Sun, Aug 2, 2009 at 12:42 PM, chris_huh chris@gmail.com wrote: I tried that and it didn't work. The second code i pasted above works (doesn't jump to top of page) but it loses the fading ability. Where as the first bit of code has the fadign but jumps to the top, i don't know where to put the return false statement in that bit of code to prevent it doing that. On Aug 2, 11:26 am, waseem sabjee waseemsab...@gmail.com wrote: return false is the standard method and will work no problem :) there is an alternative as well $(document).ready(function(e){ // function becomes function(e) e.preventDefault(); // prevent default behavior and ensure the click is canceled. $('#tabs div').hide(); $('#tabs div:first').show(); $('#tabs ul li:first').addClass('active'); $('#tabs ul li a').click(function(){ $('#tabs ul li').removeClass('active'); $(this).parent().addClass('active'); var currentTab = $(this).attr('href'); $('#tabs div').hide(); $(currentTab).show(); }); }); just curious through if any expert out there can explain the difference between using return false; and e.preventDefault(); On Sun, Aug 2, 2009 at 12:21 PM, chris_huh chris@gmail.com wrote: Thanks. I don't know javascript much. Where would i put the return false I have: script type=text/javascript $(function() { $(#tabs).tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 5000); }); /script And i am not using onclick events. I tried using: script type=text/javascript $(document).ready(function(){ $('#tabs div').hide(); $('#tabs div:first').show(); $('#tabs ul li:first').addClass('active'); $('#tabs ul li a').click(function(){ $('#tabs ul li').removeClass('active'); $(this).parent().addClass('active'); var currentTab = $(this).attr('href'); $('#tabs div').hide(); $(currentTab).show(); return false; }); }); /script and that works but i lose the fade effect and am not sure where to put it back in. On Jul 30, 7:33 pm, kalyan Chatterjee kalyan11021...@gmail.com wrote: Just try to write return false on tab click event. On Jul 29, 6:53 pm, chris_huh chris@gmail.com wrote: Thanks but I can't find jquery.history_remote.pack.js. I am using jquery 1.7.1 and the tabs thing that comes with JQuery UI. On Jul 29, 2:25 pm, rupak mandal rupakn...@gmail.com wrote: Hi, if you remove the jquery.history_remote.pack.js then I think it works properly. On Wed, Jul 29, 2009 at 5:50 PM, chris_huh chris@gmail.com wrote: At the moment my page will jump to the top (because of the #) whenever a new tab is clicked or when it automatically rotates to one. Is there a way to stop this, maybe using an onclick event instead of relying on the #tabs links?
[jQuery] plugin: blockui - How to Change cursor style in IE to 'not-allowed' on overlay???
I have a DIV blocked from data entry in IE, Firefox, Safari and Opera. Functionally all is okay -- super plugin!!! The only problem left is that the cursor does not change to 'not- allowed' on the overlay when I use IE 6,7 or 8. All other browsers render the cursor okay??? Here's the code: $().ready(function() { Protect('#divData'); $('#cbProtected').bind('click', function(e, ui) { if ($(this).is(':checked')) Protect('#divData'); else Unprotect('#divData'); }); }); function Protect(el) { $(el).block({ message: null, overlayCSS: { backgroundColor: null, opacity: 1.0, cursor: 'not-allowed' } }); }; function Unprotect(el) { $(el).unblock(); };
[jQuery] Re: What am i doing wrong????
IS that correct sytnax?? On Fri, Jul 31, 2009 at 7:08 PM, Joel Polsky polskystud...@gmail.comwrote: Like this? (Which doesn't work) $(input[name=PlannedInvitationsOther]).focus(function(){ $(input[name=PlannedInvitations][value=Other]).attr('checked','checked'); } ); On Fri, Jul 31, 2009 at 7:00 PM, FrenchiInLA mamali.sohe...@gmail.comwrote: You should have .attr('checked','checked'), by the way you don't need to wrap your filter by QUOTE $('input[name=PlannedInvitationsOther]:checked') would work as well PictureMan wrote: Ah.. one darn missing suqiggly can ruin the whole darn thing... Another question, related to that... I want when the user clicks inside the text box, that the matching radio button becomes the selected button. Hence if they selected 100 invitations,but then decided they want 10,000, thus have to type it int the box - i need the radio button to move. And conversly if they go from the box to a radio button the box needs to clear out. For some reason this stoped working: $(input[name='PlannedInvitationsOther']).focus (function(){$(input[name='PlannedInvitations'][value='Other']).attr('checked',true);} ) $(input[name='PlannedInvitations']).focus (function(){ $(input[name='PlannedInvitationsOther']).removeAttr(value); } ) Ideas why? On Fri, Jul 31, 2009 at 3:38 PM, Leonardo K leo...@gmail.com wrote: You are not closing the brackets in theses rules: PlannedInvitationsOther and PlannedAttendanceOther PlannedInvitationsOther: { required: function(element){ return $(input=[name='PlannedInvitations'][value='Other']).is(':checked'); }, number: true }, PlannedAttendanceOther: { required: function(element) {return $(input=[name='PlannedAttendance'][value='Other']).is(':checked');}, number:true }, On Fri, Jul 31, 2009 at 16:29, PictureMan polskystud...@gmail.com wrote: I've actually confined (I think) the error to somewhere in the below code. The 6 lines that are commented out contain the problem, as it stands now (with commented out sections) the page validates, when I uncomment either group, I get the same error. I these 2 cases the required line is looking at a radio button with a specific value - think last item in a list of radio buttons, with a text box for more other info if that radio button is checked. rules: { AgencyName: required, Address1: required, CityStateZip: required, phone: {required: true, number: true, minlength: 10, maxlength: 10}, Key_Contact: required, EmailAddress: {required: true, email: true}, EventAgencyName: required, EventAddress: required, EventCity: required, EventZip: required, EventState: required, EventContact: required, EventContactPerson: required, EventPhoneNumber: {required: true, number: true, minlength: 10, maxlength: 10}, EventEmailAddress: {required: true, email: true}, EventWebsite: {url: true}, Message: required, Budget: {required:true, number:true}, CabinsSoldTarget: {required:true, number:true}, GrossSalesTarget: {required:true, number:true}, OtherCruiseLine: { required: #Other:checked }, DestinationsPicked: required, PlannedInvitations: required, // PlannedInvitationsOther: { // required: function(element){return $(input= [name='PlannedInvitations'][value='Other']).is(':checked');}, // number: true, PlannedAttendance: required, // PlannedAttendanceOther: { // required: function(element) {return $(input= [name='PlannedAttendance'][value='Other']).is(':checked');}, // number:true, IntendToParticipate: required }, On Jul 31, 3:08 pm, Leonardo K leo...@gmail.com wrote: This problem occurs when a comma is missing. Post your entire code of the validation. On Fri, Jul 31, 2009 at 16:00, PictureMan polskystud...@gmail.com wrote: When I add this rule to a page with the other rules, my page stops validating. Works fine if I don't add it. What this is for is a check box next to a input box. IF the check box is checked,
[jQuery] [plugin] How to change message while the page is blocked using blockUI plugin
Hello people, i'd like to know if it's possible change de message while the page is block by blockUI jquery plugin. I've tried a lot of things, but none was good. One thing i've tried was using CSS selectors like: $('blockUI blockMsg blockPage').innerHTML but it hasn't worked. Any idea? Thanks Veja quais são os assuntos do momento no Yahoo! +Buscados http://br.maisbuscados.yahoo.com
[jQuery] Optional Buttons in Modal Form Dialog
Hi All, I am creating an form dialog that will be slightly different for creating data than editing data. I'm pretty new to jquery, but I'm using the jqueryui and it seems to be working fine, but now I'm looking to change the labels of a couple of buttons and have one button available during editing (but not creating). Hope this makes sense... Is there a way to do that without having to create new dialogs? Thanks. -D. Israel d...@ebji.org http://www.customcodebydan.com AIM: JudoDanIzz If a dozen smart, successful people who've achieved something great are all giving the same advice, take it.
[jQuery] sliding button
Hello guys, I'm trying to create a couple of download buttons (one placed at the left and the other at the right of my page) with sliding effect: basically I want to show just a piece of it and when the mouse goes over to slide it in order to show if the linked document is available or not. I have successfully implemented the effect I want for the right button as described below: #HTML div class=download_badge style=float: right;img src= badge_whitepaper.png/div #CSS .download_badge { width: 209px; height:79px; overflow: hidden; } #JS $(document).ready(function(){ $('.download_badge').hover(function() { $(this).animate({ width: 273px}); }, function() { $(this).animate({ width: 209px}); $(this).addClass(download_badge); } ); } you can see the final result here: http://www.vimeo.com/5891973 Now my question: how can I achieve the same effect for the left button? On left side I need to show the right part of the image and animate it when the mouse is over but how can I do that? Thanks Sig
[jQuery] fxqueues with afterFinish ?
Hi All I've beem using prototype and scriptaculous and want to swith to jQuery. The thing is that scriptaculous has a very nice queuing mechanism. I think most of it can also be done by fxqueues, however I don't see how to call a function when a certain effect finishes. Can this be done ? and is fxqueues the best choice ? Scriptaculous does something like: new Effect.Parallel(effect[i], { queue: 'end', duration: duration[i], afterFinish:callback} ) ... thnx LuCa ps fxqueues: http://www.decodeuri.com/jquery-fxqueues-plugin-20/
[jQuery] Select tags within a string using jQuery
Hi all, I have my website getting a value as a result of an ajax call. After that, I would like to insert that result (a string) into a tag. However, I would like to insert that result in a way that (1) it must have opacity = 0, then (2) it will slideDown() so the whole content list being pushed down using animation, and finally (3) change opacity = 1. Imagine this is just like a Facebook message list insert process The way I am planning to do this is to return the result string from ajax to opacity=0 first. However, I don't know how to use jQuery to select a tag from within a string. I know jQuery only select from the DOM. So how to do this? Any advice? Thanks
[jQuery] Re: get parent where
I've went with a problem similliar to yours, a guy helped me out $(this).closest('.your-item').attr('id'); Try putting in your div a class named your-item like so, class=your- item and then when you click on your span i think it wold give your div id, just try it :) Example: div class=your-item id=thirdArea span id=subSecond ul liFirst Item/li liSecond Item/li liThird Item/li /ul /span /div On 2 Ago, 20:07, pedalpete p...@hearwhere.com wrote: I've been trying to get a specific parent element traversing up the DOM until I find it, but it is getting to be some very verbose code, and I'm thinking there must be a better way. I have a bunch of events which is fired on a click, and I am trying to figure out which of the parent divs was clicked. Now I have something like this (this is a simplified version) code div id=firstArea ul liFirst Item/li liSecond Item/li liThird Item/li /ul /div div id=secondArea span id=subSecond ul liFirst Item/li liSecond Item/li liThird Item/li /ul /span /div div id=thirdArea span id=subSecond ul liFirst Item/li liSecond Item/li liThird Item/li /ul /span /div /code So, i'm trying to get the id of the div. I was hoping I could do this code $(this).parent('div').attr(id); /code but unfortunately that doesn't work as the first parent is not always a div. So what I end up with is code var getParent=$(this).parent().attr(id); if(getParent=='subSecond'){ getParent=$(this).parent().parent().attr(id);} /code Not the worst code ever, but I think there must be a better way to do this, and it may get more confusing/verbose as I continue to add elements and types. Is there a better way of doing this?
[jQuery] Re: how to make a function with JQuery
thanks everyone It's almost simple as MorningZ wrote ;) I've made more impressive evolution using jQery. thanks On 12 juin, 09:14, Michael Lawson mjlaw...@us.ibm.com wrote: It almost sounds to me like you're confused on what jQuery actually is? Does it works similary like woring with Javascript and DOM ? in your email jQuery is a code library for use by javascript code. It provides easy access to the DOM and tons of other convenient features for you, so that you don't have to implement them yourself in javascript. In javascript, you would define a function as follows function foo() { //code here } or, several jQuery functions can take anonymous functions as input. For example jQuery.get(http://www.my-great-site.com,function(xml){ //code here can use the xml returned by the http get } does that help at all? Here is a reference on creating javascript functions:http://www.w3schools.com/js/js_functions.asp cheers Michael Lawson Development Lead, Global Solutions, ibm.com Phone: 1-276-206-8393 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: MorningZ morni...@gmail.com To: jQuery (English) jquery-en@googlegroups.com Date: 06/12/2009 09:00 AM Subject: [jQuery] Re: how to make a function with JQuery jQuery *function*? Do you mean jQuery plugin? http://www.learningjquery.com/2007/10/a-plugin-development-pattern On Jun 11, 10:54 pm, marcelsnews marcelsn...@gmail.com wrote: Hello every one, I'm a new user of JQuery and i'm trying to use it on a web site that i'm building. Keep in mind that i'm also new on the web. So i wanted to know: - How to define a function with JQuery. - Does it works similary like woring with Javascript and DOM ? - Shall my function, if allowed, be defined in the $(document).ready () ... ? thank graycol.gif 1 000AfficherTélécharger ecblank.gif 1 000AfficherTélécharger
[jQuery] Re: How can I select an element's parent?
hello,I hope this helps: $(#product_links li a).click( function() { alert($(this).parent().attr(class)); } ); On Aug 1, 11:39 am, macsig sigbac...@gmail.com wrote: Hello guys, I'm trying to update a script I found out there in order to fit better my needs. The first step I want to update is the capability to bind a dynamic number of anchors. Right now with the HTML below ul id=product_links li class=first aFIRST/a/li li class=secondSECOND/a/li li class=thirdaTHIRD/a/li /ul I have the script below: $(#product_links .first a ).bind(click, function(){ pupup_element (first); }); $(#product_links .second a ).bind(click, function(){ pupup_element (second);}); $(#product_links .third a ).bind(click, function(){ pupup_element (third);}); It works fine but since the number of anchors changes dynamically (through RoR) I'd like to have just 1 line that binds all the anchors. So here 2 questions for you: - how can I select an element's parent? - Does the code below work? $(#product_links a ).bind(click, function(){ pupup_elemet (this.PARENT.id);}); basically I want to bind all the anchors within the product_links list to popup_element function that takes as a parameter the ID of the anchor parent. In my case the id of the list item. Thanks and have a nice weekend. Sig
[jQuery] apply css style after dynamic table row
i am calling web service and build dynamic table row. It work up to here. and then i trying to apply css style on td after that and it didn't work. Is there a work around? table id=tbid [I added row content dynamic by jquery here] table
[jQuery] Re: How to change message while the page is blocked using blockUI plugin
CSS selectors start with dot (.) On 2 Sie, 18:01, Mateus Caletti mateuscale...@yahoo.com.br wrote: Hello people, i'd like to know if it's possible change de message while the page is block by blockUI jquery plugin. I've tried a lot of things, but none was good. One thing i've tried was using CSS selectors like: $('blockUI blockMsg blockPage').innerHTML but it hasn't worked. Any idea? Thanks Veja quais são os assuntos do momento no Yahoo! +Buscadoshttp://br.maisbuscados.yahoo.com
[jQuery] Re: get parent where
$(this).closest(div).attr(id)
[jQuery] css on dynamic table row
i create tatble row dynamic using append after calling web service. It create ok. After create table i try to add css to the td but it doesn't seem to work. any idea how to resolve this. the syntax is correct. I notice when i view source, the all the row are not there. table id=tbid [row append dynamiccly] /table
[jQuery] Message didn't disappear in validation plugin
I use jquery validation plugin 1.5.5, and got problem with error message. They don't disappear when the form is valid or when i use multiple rules, second rule message didn't show, the message is still the first rule message. Here's the code: $(document).ready(function () { $('#user_form').validate({ rules : { username : { required : true, min : 4, max : 32 }, password : { required : true, min : 6 }, password_again : { required : '#password:filled', min : 6, equalTo : '#password' }, name : 'required', email : { required : true, validEmail : true } } }); }); when username is empty, required rule message appear properly, so when username less than 4 char, but when i fill username with 4 or more chars the min rule message still appear. email too, when it's blank, required rule message appear, but when i put invalid email the message still required rule message. and here is my validEmail method: $.validator.addMethod('validEmail', function (value, element) { var emailStr = value; var checkTLD=1; var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name| coop|info|pro|museum)$/; var emailPat=/^(.+)@(.+)$/; var specialChars=\\(\\)@,;:\.\\[\\]; var validChars=\[^\\s + specialChars + \]; var quotedUser=(\[^\]*\); var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; var atom=validChars + '+'; var word=( + atom + | + quotedUser + ); var userPat=new RegExp(^ + word + (\\. + word + )*$); var domainPat=new RegExp(^ + atom + (\\. + atom +)*$); var matchArray=emailStr.match(emailPat); if (matchArray==null) { //alert(Email address seems incorrect (check @ and .'s)); return false; } var user=matchArray[1]; var domain=matchArray[2]; for (i=0; iuser.length; i++) { if (user.charCodeAt(i)127) { //alert(Ths username contains invalid characters.); return false; } } for (i=0; idomain.length; i++) { if (domain.charCodeAt(i)127) { //alert(Ths domain name contains invalid characters.); return false; } } if (user.match(userPat)==null) { //alert(The username doesn't seem to be valid.); return false; } var IPArray=domain.match(ipDomainPat); if (IPArray!=null) { for (var i=1;i=4;i++) { if (IPArray[i]255) { //alert(Destination IP address is invalid!); return false; } } return true; } var atomPat=new RegExp(^ + atom + $); var domArr=domain.split(.); var len=domArr.length; for (i=0;ilen;i++) { if (domArr[i].search(atomPat)==-1) { //alert(The domain name does not seem to be valid.); return false; } } if (checkTLD domArr[domArr.length-1].length!=2 domArr [domArr.length-1].search(knownDomsPat)==-1) { //alert(The address must end in a well-known domain or two letter + country.); return false; } if (len2) { //alert(This address is missing a hostname!); return false; } return true; }, 'Email is not valid');
[jQuery] Re: Unable to trigger a event on page load
Hi wolf, Please try by rebinding the event in page B once page B is loaded. Hope this will help. Thanks! Praful On Sun, Aug 2, 2009 at 2:02 AM, wolf yingde...@gmail.com wrote: I bind a custom event on page A,then ajax load page B。In page B,there is a a link which trigger the custom event. Problem is :the trigger function work when i place the trigger function in page A ,but not work in B by ajax load. Help! jQuery Core:v1.3.2
[jQuery] jquery not work when firebug in on
windows xp firefox 3.0.6 jquery:1.3.2(latest release) script: $(document).ready( function() { $(a).click( function(event) { alert(Click); } ); } ); when i turn the firebuf off,it works well. Please help. thanks.
[jQuery] Looking for a Good JavaScript Editor that Supports JQuery
Does anyone know of a good JavaScript editor that supports JQuery? Anyone sucessfully integrate JQuery into Eclipse/WTP or JSEclipse?
[jQuery] tooltip on newly added elements?
Will tooltip show itself when I add IMG with tile and alt? or do i have to reinit it everytime?
[jQuery] validate - require validation in multiple varying instances
I'm using the jquery validator supplied here: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ The form I made has six different sections corresponding to six different sets of information being entered. For clarity, I should mention that this is an RSVP form, and the user is able to RSVP for up to six people. The sections and input fields are numbered accordingly: section1 firstname1 lastname1, section2 firstname2 lastname2... section6 firstname6 lastname6 To indicate how many people are being entered, there is a radio button, and the user is required to select a number 1 through 6. (i.e. if the number 3 is selected, the user is RSVPing for 3 people, and thus must enter all required information for person 1, person 2, and person 3.) The problem is that I don't know how to require validation on a certain field if one of several conditions are met. This works: 'firstname2': { required: #guests_two:checked, }, This does not: 'firstname2': { required: #guests_one:checked, required: #guests_two:checked, }, This does not: 'firstname2': { required: #guests_one:checked || #guests_two:checked, }, This does not: 'firstname2': { required: #guests_one:checked }, 'firstname2': { required: #guests_two:checked }, Any help would be greatly appreciated!
[jQuery] Re: plugin: blockui - How to Change cursor style in IE to 'not-allowed' on overlay???
Found my own answer for anyone who is interested... Changed overlayCSS to: overlayCSS: { backgroundColor: '#000', opacity: 0.0, cursor: 'not-allowed' } Now 'not-allowed' cursor style displays in all browsers as the ONLY visual clue to inputs being protected (not allowing data entry, events, etc.). On Aug 2, 9:39 am, Marv mcslay...@gmail.com wrote: I have a DIV blocked from data entry in IE, Firefox, Safari and Opera. Functionally all is okay -- super plugin!!! The only problem left is that the cursor does not change to 'not- allowed' on the overlay when I use IE 6,7 or 8. All other browsers render the cursor okay??? Here's the code: $().ready(function() { Protect('#divData'); $('#cbProtected').bind('click', function(e, ui) { if ($(this).is(':checked')) Protect('#divData'); else Unprotect('#divData'); }); }); function Protect(el) { $(el).block({ message: null, overlayCSS: { backgroundColor: null, opacity: 1.0, cursor: 'not-allowed' } }); }; function Unprotect(el) { $(el).unblock(); };
[jQuery] Re: jquery 1.3.2 error with $(':inp...@name=submit]')???
Just remove the @ and it'll work fine. --John On Sun, Aug 2, 2009 at 12:07 PM, micorreo13 micorre...@gmail.com wrote: I was using jquery-1.2.6 and now, I started to use jquery-1.3.2, and I get my first difference: when I use the wrapped set operation $ (':inp...@name=submit]') with jquery-1.3.2 it returns all input fields, but if I use it with jquery-1.2.6 it returns 0 (as espected). Is it an error with 1.3.2 version?What do you think I'm doing wrong? Thank you very much. P.S.: this wrapped set is used by jQuery Form Plugin and, if I have file uploads I get the alert 'Error: Form elements must not be named submit.' from the function fileUpload of this plugin.
[jQuery] Re: jquery 1.3.2 error with $(':inp...@name=submit]')???
remove the @ sign. it is no longer needed. On Sun, Aug 2, 2009 at 10:45 PM, John Resig jere...@gmail.com wrote: Just remove the @ and it'll work fine. --John On Sun, Aug 2, 2009 at 12:07 PM, micorreo13 micorre...@gmail.com wrote: I was using jquery-1.2.6 and now, I started to use jquery-1.3.2, and I get my first difference: when I use the wrapped set operation $ (':inp...@name=submit]') with jquery-1.3.2 it returns all input fields, but if I use it with jquery-1.2.6 it returns 0 (as espected). Is it an error with 1.3.2 version?What do you think I'm doing wrong? Thank you very much. P.S.: this wrapped set is used by jQuery Form Plugin and, if I have file uploads I get the alert 'Error: Form elements must not be named submit.' from the function fileUpload of this plugin.
[jQuery] Re: Slow response to AJAX calls in IE7
It could be the response callback. But I have spent a half a day optimising the callback code for speed. I have seen some dramatic improvement - response delays of 3-4 seconds dropping to 1-2, but it still feels sluggish. There are two main ajax calls. The first is only called once when the page is loaded. It responds with a large data set that is then used the build the page. This call can be quite slow, but as it only happens once I can live with it. The second AJAX call is made when the user clicks on an element built in step 1. This call collects data from the interface on the clicked element(s) and submits it, then based on the returned data it updates the state of the displayed elements. While this update does not alter the structure of the page (no DOM elements are created or destroyed), it does add and remove classes from elements and then based on the classes, animates the show/hide of elements. This is the section I have optimised. From what I have seen there are two factors slowing down the response. The first is the actual AJAX response in IE7. The second is the post response processing. I am looking for suggestions on fixing the AJAX response time in IE7. The other I can address already. I will see about getting a link to the running code. It is for a client site that has not gone live yet. It is a large and complex application though, so it might be overkill.
[jQuery] Re: Looking for a Good JavaScript Editor that Supports JQuery
I believe that Aptana offers jQuery support. -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of S2 Sent: Saturday, August 01, 2009 8:21 PM To: jQuery (English) Subject: [jQuery] Looking for a Good JavaScript Editor that Supports JQuery Does anyone know of a good JavaScript editor that supports JQuery? Anyone sucessfully integrate JQuery into Eclipse/WTP or JSEclipse?
[jQuery] form submit
hello, Recently i've discovered how to use dynamicaly loaded content, with javascript. $(div ul li a).live(click, function() { //. } Now I want to know I'm using a small form, with more than 1 field, and a 'submit button'. which looks like this: Type: select name=typecoinsCASHIN id=typecoinsCASHINoption value=0Normal chips/optionoptionPremium chips/options/ select Amount: input type=text name=amountCOINSCASHIN / input type=submit name=chipInChips id=chipInChips value=Chip in! / And the javascript checking if the button is clicked: $(div input[type=submit]).live(click, function() { //. } Now... within the javascript function, how can I use the values within chupInChips, and amountCOINSCASHIN in the function. I have no clue, as checking for dynamically loaded content, and using this onclick, mouseover, whatever, was hard enough for me to figure out. So all I want is to use the values in these input items, within the called function. I hope someone is able to help me. solow.
[jQuery] Re: Looking for a Good JavaScript Editor that Supports JQuery
+1 Aptana. excellent for javascript in general, comes with support for jquery 1.3 enhanced code support. excellent html and css editor as well. built on eclipse framework without all the java editor bulk. 2009/8/2 cfddream 371486...@qq.com Aptana? -- Ever Now .. -- Original -- *From: * S2smnthsm...@gmail.com; *Date: * 2009年8月2日(星期天) 上午9:21 *To: * jQuery (English)jquery-en@googlegroups.com; *Subject: * [jQuery] Looking for a Good JavaScript Editor that Supports JQuery Does anyone know of a good JavaScript editor that supports JQuery? Anyone sucessfully integrate JQuery into Eclipse/WTP or JSEclipse? -- Christopher Thatcher
[jQuery] Re: css on dynamic table row
this is a more css problem than a jquery problem. you have to make the right order in your css and use right selector. i had the same problem. example 1 td.td-class div a { /*some styles*/ } a.active:hover { /*some styles such as background-image dondt wordek but border worked. in my case dont worked on dynamic generated markup because its not very DOMified i think- that are not 100% clear paths and maybe its troube for the js interpreter and the render engine- this is only speculation*/ } /example 1 example 2 td.td-class div a { /*some styles*/ } ... ... td.td-class div a.active:hover { /* look at the selector */ /* i think now the js interpreter sees the path better than before in my case it worked- try to mani pulate your css order and use right selectors*/ } /example 2 example 2 worked in my case try it out ;) On 2 Aug., 05:53, dealkk jasonpha...@gmail.com wrote: i create tatble row dynamic using append after calling web service. It create ok. After create table i try to add css to the td but it doesn't seem to work. any idea how to resolve this. the syntax is correct. I notice when i view source, the all the row are not there. table id=tbid [row append dynamiccly] /table
[jQuery] can't update div through dialog
When I try to animate a DIV-element with this code: $(this).parents(.pane).animate({ backgroundColor: #fbc7c7 }, fast) .animate({ opacity: hide }, slow) everything works fine. But when I try to do it after I press a button in a dialog - nothing works! Why? Here's the code: $(document).ready(function(){ $(#dialog).dialog({ bgiframe: true, resizable: false, height:140, autoOpen: false, modal: true, overlay: { backgroundColor: '#000', opacity: 0.5 }, buttons: { 'Удалить новость': function() { $.get( news.php, act=deleteid=+id ); $(this).dialog('close'); $(this).parents(.pane).animate({ backgroundColor: #fbc7c7 }, fast) .animate({ opacity: hide }, slow) return false; }, 'Отмена': function() { $(this).dialog('close'); return false; } } }); $(.pane .btn-delete).click(function(){ id = $(this).parents('.pane').find('td:first').attr('id'); $(#dialog).dialog('open'); return false; }); });
[jQuery] Re: Select tags within a string using jQuery
try regular expressions http://www.w3schools.com/jsref/jsref_obj_regexp.asp http://www.w3schools.com/js/js_obj_regexp.asp or http://www.regular-expressions.info/javascript.html http://www.regular-expressions.info/javascriptexample.html maybe it helps ;) On 2 Aug., 21:13, cohq82 quang...@gmail.com wrote: Hi all, I have my website getting a value as a result of an ajax call. After that, I would like to insert that result (a string) into a tag. However, I would like to insert that result in a way that (1) it must have opacity = 0, then (2) it will slideDown() so the whole content list being pushed down using animation, and finally (3) change opacity = 1. Imagine this is just like a Facebook message list insert process The way I am planning to do this is to return the result string from ajax to opacity=0 first. However, I don't know how to use jQuery to select a tag from within a string. I know jQuery only select from the DOM. So how to do this? Any advice? Thanks
[jQuery] Re: Select tags within a string using jQuery
I am not really used to RegEx. If the return html is like this, how to add an attribute to .msg-item before parsing out? li class=msg-item div class=msg-avatar a class=noborder-img href=/nvthoaiimg src=http:// kuckustorage.blob.core.windows.net/kuckuimages/53a2ceb8-de2c-4601-a862- c78d9e634ca6.jpg?timeout=240 alt=Avatar width=50 height=50// a /div div class=msg-body span class=msg-texta href=/nvthoainvthoai/a hi/ span span class=msg-timestampCách đây 10 giờ/span div id=msg_action_5408 class=msg-actions a class=msg-action-replyTrả lời/ a a class=msg-action-deleteXóa/ aa class=msg-action-quoteTrích dẫn/aa class=msg-action-favThích/ a /div a class=msg-action-isfav style=display:none/a /div div class=msg-dotted-line/div /li On Aug 2, 4:03 pm, Stefano ares...@gmail.com wrote: try regular expressions http://www.w3schools.com/jsref/jsref_obj_regexp.asphttp://www.w3schools.com/js/js_obj_regexp.asp orhttp://www.regular-expressions.info/javascript.htmlhttp://www.regular-expressions.info/javascriptexample.html maybe it helps ;) On 2 Aug., 21:13, cohq82 quang...@gmail.com wrote: Hi all, I have my website getting a value as a result of an ajax call. After that, I would like to insert that result (a string) into a tag. However, I would like to insert that result in a way that (1) it must have opacity = 0, then (2) it will slideDown() so the whole content list being pushed down using animation, and finally (3) change opacity = 1. Imagine this is just like a Facebook message list insert process The way I am planning to do this is to return the result string from ajax to opacity=0 first. However, I don't know how to use jQuery to select a tag from within a string. I know jQuery only select from the DOM. So how to do this? Any advice? Thanks
[jQuery] Re: form submit
var tcC = typecoinsCASHIN.val(); please add values to all your option tag. if(tcC == 1) { } On Mon, Aug 3, 2009 at 4:03 AM, solow solow.wes...@gmail.com wrote: hello, Recently i've discovered how to use dynamicaly loaded content, with javascript. $(div ul li a).live(click, function() { //. } Now I want to know I'm using a small form, with more than 1 field, and a 'submit button'. which looks like this: Type: select name=typecoinsCASHIN id=typecoinsCASHINoption value=0Normal chips/optionoptionPremium chips/options/ select Amount: input type=text name=amountCOINSCASHIN / input type=submit name=chipInChips id=chipInChips value=Chip in! / And the javascript checking if the button is clicked: $(div input[type=submit]).live(click, function() { //. } Now... within the javascript function, how can I use the values within chupInChips, and amountCOINSCASHIN in the function. I have no clue, as checking for dynamically loaded content, and using this onclick, mouseover, whatever, was hard enough for me to figure out. So all I want is to use the values in these input items, within the called function. I hope someone is able to help me. solow.
[jQuery] Re: form submit
and for the input text input? On 3 aug, 07:11, waseem sabjee waseemsab...@gmail.com wrote: var tcC = typecoinsCASHIN.val(); please add values to all your option tag. if(tcC == 1) { } On Mon, Aug 3, 2009 at 4:03 AM, solow solow.wes...@gmail.com wrote: hello, Recently i've discovered how to use dynamicaly loaded content, with javascript. $(div ul li a).live(click, function() { //. } Now I want to know I'm using a small form, with more than 1 field, and a 'submit button'. which looks like this: Type: select name=typecoinsCASHIN id=typecoinsCASHINoption value=0Normal chips/optionoptionPremium chips/options/ select Amount: input type=text name=amountCOINSCASHIN / input type=submit name=chipInChips id=chipInChips value=Chip in! / And the javascript checking if the button is clicked: $(div input[type=submit]).live(click, function() { //. } Now... within the javascript function, how can I use the values within chupInChips, and amountCOINSCASHIN in the function. I have no clue, as checking for dynamically loaded content, and using this onclick, mouseover, whatever, was hard enough for me to figure out. So all I want is to use the values in these input items, within the called function. I hope someone is able to help me. solow.- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -
[jQuery] Re: What Do I Do wrong?
Hello, here is the body of the XHTML: body div id=navibg span class=noscreendiams; /spana href=/news id=news class=naviaNews/a span class=noscreendiams; /spana href=/about id=about class=naviaAbout/a span class=noscreendiams; /spana href=/services id=services class=naviaServices/a span class=noscreendiams; /spana href=/references id=references class=naviaReferences/a span class=noscreendiams; /spana href=/contact id=contact class=naviaContact/a span class=noscreendiams; /spana href=/imprint id=imprint class=naviaImprint/a /div div id=subnavibgnews class=subnavibg !-- Several links within -- /div div id=subnavibgabout class=subnavibg !-- Several links within -- /div div id=subnavibgservices class=subnavibg !-- Several links within -- /div div id=subnavibgreferences class=subnavibg !-- Several links within -- /div div id=subnavibgcontact class=subnavibg !-- Several links within -- /div /body I hope this helps to understand my code better ;-) Thank you