[jQuery] Re: Newbie with jQuery
I am sure that you can design better way than 10 separate call, but anyway with your case you can at least group all call event like $('img[id^=img_]').click(function(){ // here you have all img with id starting with img_ click // then you can get the id of caller var id =$(this).attr('id'); // get the number var number() = id.splist('_'); // number[1] will give 1, 2 etc of img_1 etc. //now call your dialog $('#dialog_' + number[1]).dialog('close'); }); On Aug 30, 8:20 am, Reynier Pérez Mira rper...@uci.cu wrote: Hi every: I'm starting with jQuery and I have a lot of doubts. I'm reading the following books: - jQuery Reference Guide (Jonathan Chaffer, Karl Swedberg) - Learning jQuery 1.3 (Jonathan Chaffer, Karl Swedberg) - jQuery UI 1.6 (Dan Wellman) But as I said before I have a lot of doubts. Here goes the first. I'm trying to use the Dialog component from jQuery UI to show some modal dialogs in my web app. For just one dialog I haven't problems because I do this: In my HTML: img id=img_1 class=help title=Show info about: Dir name field alt=Show info about: Dir name field src=/images/information.png / div class=dialog id=dialog_1 title=Show info about: Dir name fieldpThe director name used by the system administrator. This directive is required./p/div And the JS code: $('#dialog_1').dialog({ autoOpen: false, width: 600, modal: 'true', resizable: false, draggable: false, buttons: { Aceptar: function() { $(this).dialog(close); } } }); $('#img_1').click(function(){ $('#dialog_1').dialog('open'); return false; }); Now suppose that I have 10 different images: img_1, img_2, ..., img_10 and for each of them I want associated a different dialog: dialog_1, dialog_2, ..., dialog_10. I generate the IDs dinamically with PHP this is not the problem, the problem is how to associated each image to the correspondent dialog. I mean for example img_1 = dialog_1 and so on and then when I click the ID=img_1 then the dialog_1 will be show and so on. ¿Could any body help me with the jQuery code? Cheers and thanks in advance -- Ing. Reynier Pérez Mira
[jQuery] Re: Replacing like items
you can add an id to your checkbox in order to get much easier reference to element clicked. Let's say you have id = widget1||123456, widget2||123456 etc then $('input[type=checkbox][id$=123456]')'.click(function(){ $('input[type=checkbox][id$=123456]')'.not($(this)) will give you all other check box // for more generic id yu can get the lase digit of the id and select all others as well var id = $(this).attr('id'); // get the last part with split function var chkid() = id.split('||'); now you get all other check box with $('input[type=checkbox][id$=' + chkid[1] + ']')'.not($(this)) }); On Aug 30, 12:44 pm, Steffan A. Cline stef...@hldns.com wrote: I have a form of data I am working on where I may have *nearly* the same thing appear with a checkbox appear multiple times. For example: input type=checkbox name=blah value=widget1||123456 input type=checkbox name=blah value=widget2||123456 input type=checkbox name=blah value=widget3||123456 input type=checkbox name=blah value=widget4||123456 input type=checkbox name=blah value=widget5||123456 So, if checkbox #1 (widget1) is checked, it will either disable all other ones containing the sku 123456 OR replace the others in the form having sku 123456 with an image of a sort. Is there a way to select this without iterating through every checkbox in the form and looking at it's value? Thanks Steffan --- T E L 6 0 2 . 7 9 3 . 0 0 1 4 | F A X 6 0 2 . 9 7 1 . 1 6 9 4 Steffan A. Cline stef...@execuchoice.net Phoenix, Azhttp://www.ExecuChoice.net USA AIM : SteffanC ICQ : 57234309 YAHOO : Steffan_Cline MSN : stef...@hldns.com GOOGLE: Steffan.Cline Lasso Partner Alliance Member ---
[jQuery] Re: How can I select an element's parent?
you should change your html something like: ul id=product_links li id=firsta href=#FIRST/a/li li id=seaconda href=#SECOND/a/li li id=thirda href=#THIRD/a/li /ul then in order to get the id of your li you can use the following code $('a', '#product_links').click(function() { alert($(this).parent().attr('id')); }); 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] Re: What am i doing wrong????
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, the field is mandatory. OtherCruiseLine: { required: function(element) { return $(input[name='CruiseLinesPicked'][value='Other']).is (':checked'); } without this rule the page validates. With this I get an error of: missing } after property list. But not sure what's wrong.. Thanks! -- View this message in context: http://www.nabble.com/What-am-i-doing-wrong-tp24761535s27240p24764206.html Sent from the jQuery General
[jQuery] Re: Fetching data from callback with $.ajax
I would do like that: isAuthenticated function return true or false according the entry, then check if is Authenticated, ajax to your php something like if(isAuthenticated($('#username').val(), $('#password').val())) { $ajax( { -- -- success: function(msg){ alert(msg=='authenticated') } } ); } On Jul 26, 3:56 am, Sander Thalen stha...@gmail.com wrote: Hello all, I've recently started with jQuery because I wanted to use it for posting details from an login form to a PHP script which should return whether the user is authenticated or not. For this I use $.ajax, because of it's flexibility and I prefer to use it in this implementation. Reading (jQuery docs and examples) and searching a lot did not solve me on one issue: fetching the data in the callback to the global scope. This one is driving me crazy. Here is the code: script type=text/javascript $(document).ready(function(){ var form = $('#form'); form.submit(function(){ // Only execute this function on submit if(isAuthenticated($('#username').val(), $('#password').val())) { return true; // I only want the form to be submitted when the credentials are valid (found to be valid by the PHP script) } else { return false; } }); function isAuthenticated(username, password) { // This function call the PHP script to ask whether the credentials are valid or not. $.ajax({ type: POST, url: json.php?module=loginaction=authenticate, data: username= + username + password= + password, success: function(msg) { alert(msg); // This returns 'authenticated' in plain text (at the moment) from the PHP script. Functions fine or course, but I want to use it outside this function. How?? } }); And here is why I want this to work: if(msg == authenticated) { // This function should be able to read the var 'msg' from the callback in the function above. How? alert(Outside: + msg); // At this point, msg is of course undefined. return true; } } }); /script So the only question actually is, how can I let the function that should check the message of the response know that 'msg' has been set? I hope this makes it clear what I mean ;) Thanks, Sander
[jQuery] Re: Setting identical events to multiple elements using a for loop
in your case you can use: $('span[id^sp_span]') to get all span with id starting with sp_span then you can get the id when is clicked $('span[id^sp_span]').click(function(){ var spanID = $(this).attr('id').split('_')[1] ;will give you span1, span2 etc $('#'+spanID).slideToggle(slideSpeed); }); On Jul 25, 4:37 pm, Blake stickynote...@gmail.com wrote: On my site, I have some click-able spans (will be referred to as toggle spans) that show or hide other spans (that contain the content I want on my site; will be referred to as content spans). The layout of these spans is like this: -- span id=sp_span1Span 1/span - span id=sp_span2Span 2/span - span id=sp_span3Span 3/span span class=contentSpan id=span1 pSpan 1 content./p /span span class=contentSpan id=span2 pSpan 2 content./p /span span class=contentSpan id=span3 pSpan 3 content./p /span -- Then, in my jQuery I have something like this: -- slideSpeed=1000; $(span#sp_span1).click(function () { $(span#span1).slideToggle(slideSpeed); $(span.contentSpan:not(#span1)).slideUp(slideSpeed); }); $(span#sp_span2).click(function () { $(span#span2).slideToggle(slideSpeed); $(span.contentSpan:not(#span2)).slideUp(slideSpeed);}); -- and so on for each separate content span. What the above code does is: for example, when toggle span 1 is clicked on, content span 1 opens if it is not open, and if content span 2 or 3 is open, that content span is closed and content span 1 is opened. (If that doesn't make sense, I apologize, and a download-able example can be found here:http://willhostforfood.com/access.php?fileid=76513) This method works perfectly fine, but to make it easier for me to add more content spans, I would like to use a for loop that will automatically enter all that for me. What I would like to do in my jQuery is use an array that will contain the IDs of all the different content spans I want to have displayed on the page. Then, a for loop will enter the appropriate information (identical to the code above). I've tried many things, but I cannot get this to work. Here's kind of what I have: -- sections=new Array(span1,span2,span3); for (i=0;isections.length-1;i+=1) { $(span#+sections[i]).click(function() { $(span#+sections[i]).slideToggle(slideSpeed); //$(span.contentSpan:not(attr('id')==sections[i])).slideUp (slideSpeed);}); } -- That doesn't work, though. What I need to do is get the value of sections[i] and use that in the element bit of the code. Any ideas? If you need more information, please ask. Thanks! Blake
[jQuery] Re: jQuery Nesting Tables
I didn't go through your whole code, but you can always check existence of jquery object with 'has' to check attribution, or check for length to see if the array is not empty somethign like $('tbody[tr:last]', '[id$=GV]).length 0 means it exists. On Jul 25, 11:55 pm, nullstring jayz...@gmail.com wrote: oh grace god, someone replied. thanks @FrenchiNLA here's the generated .NET html code table class=list cellspacing=0 border=0 id=ctl00_ContentPlaceHolder1_GV style=border-collapse:collapse; tr th scope=colnbsp;/thth scope=colnbsp;/thth scope=cola href=javascript:__doPostBack ('ctl00$ContentPlaceHolder1$GV','Sort$Printer')Printer/a/thth scope=cola href=javascript:__doPostBack ('ctl00$ContentPlaceHolder1$GV','Sort$Process')Process/a/thth scope=cola href=javascript:__doPostBack ('ctl00$ContentPlaceHolder1$GV','Sort$PackageType')PackageType/a/ thth scope=cola href=javascript:__doPostBack ('ctl00$ContentPlaceHolder1$GV','Sort$LeadTime')LeadTime/a/th /trtr td a id=ctl00_ContentPlaceHolder1_GV_ctl02_HyperLink2 href=PrinterProcessPackageTypeModify.aspx? PrinterProcessPackageTypePK=1Edit/a /tdtd a id=ctl00_ContentPlaceHolder1_GV_ctl02_HyperLink1 href=PrinterProcessPackageTypeView.aspx? PrinterProcessPackageTypePK=1View/a /tdtdAlcan/tdtdGravure/tdtdLabels/ tdtd35/td /trtr td a id=ctl00_ContentPlaceHolder1_GV_ctl03_HyperLink2 href=PrinterProcessPackageTypeModify.aspx? PrinterProcessPackageTypePK=2Edit/a /tdtd a id=ctl00_ContentPlaceHolder1_GV_ctl03_HyperLink1 href=PrinterProcessPackageTypeView.aspx? PrinterProcessPackageTypePK=2View/a /tdtdAlcan/tdtdGravure/tdtdMultipack Lidding (not foil)/tdtd35/td /trtr td a id=ctl00_ContentPlaceHolder1_GV_ctl04_HyperLink2 href=PrinterProcessPackageTypeModify.aspx? PrinterProcessPackageTypePK=3Edit/a /tdtd a id=ctl00_ContentPlaceHolder1_GV_ctl04_HyperLink1 href=PrinterProcessPackageTypeView.aspx? PrinterProcessPackageTypePK=3View/a /tdtdEmsur/tdtdGravure/tdtdLabels/ tdtd30/td /trtr td colspan=6 !-- here's the table I want to remove and move on top just before the parent table -- table border=0 tr tdspan1/span/tdtda href=javascript:__doPostBack ('ctl00$ContentPlaceHolder1$GV','Page$2')2/a/td /tr /table /td /tr /table That nested table is actually the Page Links and it's not always there .. I mean, it only exists if GridView has something to page .. here's the idea behind these problem: I am using someones JS to manipulate the Table and do some column freezing stuff .. but everytime this page links exists, cells always messed up.. so my idea is to check if that page link exists, move it before the table(parent table) .. this code works .. but I need to check if the page links table exists .. this.before('divtable id=\'pages\'/table/div'); jQuery(#ctl00_ContentPlaceHolder1_GV).find('tbody tr:last').remove ().appendTo($(#pages)); On Jul 26, 12:54 am, FrenchiINLA mamali.sohe...@gmail.com wrote: Could you provide your html code generated by .net? it would help, but in general rule you don't have to check existence of an element to apply action to it. Jquery disregard the action if it doesn't exist. For your example: $('tbody[tr:last][td][table]', $(this)).remove(); will work if it can find your criteria within $(this) otherwise it does nothing. On Jul 25, 8:57 am, nullstring jayz...@gmail.com wrote: Please help? On Jul 25, 10:12 pm, nullstring jayz...@gmail.com wrote: Hi, In my last row (parent Table) with colspan(tr), I have another Table (without any.attributes) which was generated by GridView, Paging enabled and located in footer ..l How do I know if that Table exists in my last row(parent Table).. this code won't work .. if(jQuery(this).is('table')) { if(this.find('tbody tr:last td table')) { /* remove paging table element */ } }- Hide quoted text - - Show quoted text -
[jQuery] Re: Setting identical events to multiple elements using a for loop
sorry i got a typo error, the corrent code is: $('span[id^=sp_span]'). On Jul 26, 8:39 am, FrenchiINLA mamali.sohe...@gmail.com wrote: in your case you can use: $('span[id^sp_span]') to get all span with id starting with sp_span then you can get the id when is clicked $('span[id^sp_span]').click(function(){ var spanID = $(this).attr('id').split('_')[1] ;will give you span1, span2 etc $('#'+spanID).slideToggle(slideSpeed); }); On Jul 25, 4:37 pm, Blake stickynote...@gmail.com wrote: On my site, I have some click-able spans (will be referred to as toggle spans) that show or hide other spans (that contain the content I want on my site; will be referred to as content spans). The layout of these spans is like this: -- span id=sp_span1Span 1/span - span id=sp_span2Span 2/span - span id=sp_span3Span 3/span span class=contentSpan id=span1 pSpan 1 content./p /span span class=contentSpan id=span2 pSpan 2 content./p /span span class=contentSpan id=span3 pSpan 3 content./p /span -- Then, in my jQuery I have something like this: -- slideSpeed=1000; $(span#sp_span1).click(function () { $(span#span1).slideToggle(slideSpeed); $(span.contentSpan:not(#span1)).slideUp(slideSpeed); }); $(span#sp_span2).click(function () { $(span#span2).slideToggle(slideSpeed); $(span.contentSpan:not(#span2)).slideUp(slideSpeed);}); -- and so on for each separate content span. What the above code does is: for example, when toggle span 1 is clicked on, content span 1 opens if it is not open, and if content span 2 or 3 is open, that content span is closed and content span 1 is opened. (If that doesn't make sense, I apologize, and a download-able example can be found here:http://willhostforfood.com/access.php?fileid=76513) This method works perfectly fine, but to make it easier for me to add more content spans, I would like to use a for loop that will automatically enter all that for me. What I would like to do in my jQuery is use an array that will contain the IDs of all the different content spans I want to have displayed on the page. Then, a for loop will enter the appropriate information (identical to the code above). I've tried many things, but I cannot get this to work. Here's kind of what I have: -- sections=new Array(span1,span2,span3); for (i=0;isections.length-1;i+=1) { $(span#+sections[i]).click(function() { $(span#+sections[i]).slideToggle(slideSpeed); //$(span.contentSpan:not(attr('id')==sections[i])).slideUp (slideSpeed);}); } -- That doesn't work, though. What I need to do is get the value of sections[i] and use that in the element bit of the code. Any ideas? If you need more information, please ask. Thanks! Blake- Hide quoted text - - Show quoted text -
[jQuery] Re: jQuery Form Validation
how about $('input[type=text]').keyup(function() { if ($(this).val().length == 2) { $(this).prev().find('span').empty(); } }); On Jul 26, 10:36 am, Tuppers360 tuppers...@sky.com wrote: Hi there just wondering if I can get some help from you guys? I have some code as per: // validate signup form on keyup and submit var validator = $('form').validate({ event: 'keyup', rules: { '%= ddlRank.UniqueID %': { required: true }, '%= txtSurname.UniqueID %': { minlength: 2, required: true }, '%= txtForename.UniqueID %': { minlength: 2, required: true }, '%= ddlGender.UniqueID %': { required: true }, '%= txtBirthDate.UniqueID %': { required: true, custEmailVal: true } }, //end rules messages: { '%= txtSurname.UniqueID %': { minlength: jQuery.format(Enter at least {0} characters), required: This field is required }, '%= txtForename.UniqueID %': { minlength: jQuery.format(Enter at least {0} characters), required: This field is required }, '%= ddlGender.UniqueID %': { required: This field is required }, '%= txtBirthDate.UniqueID %': { required: This field is required } }, //end messages // specifying a submitHandler prevents the default submit, good for the demo submitHandler: function() { alert(submitted!); }, //end submitHandler // set this class to error-labels to indicate valid fields success: function(label) { // set nbsp; as text for IE label.html(nbsp;).addClass(checked); $('label.checked').addClass('alt'); //$('form :input') // .filter('.required').prev ('label.checked').find('span').hide(); }, //end success function(label) invalidHandler: function(form, validator) { var errors = validator.numberOfInvalids(); if (errors) { var message = errors == 1 ? 'You missed 1 field. It has been highlighted' : 'You missed ' + errors + ' fields. They have been highlighted'; $('div/div') .attr({ 'id': 'submitError', 'class': 'warning' }) .insertBefore('#newuserForm'); $(div#submitError).html(message); $(div#submitError).show(); $('form :input') .filter('.required').prev('label').find ('span').hide(); } else { $(div#submitError).hide(); } } //end invalidHandler }); //end validate all my html is an ordered list and the within each li tag I have this structure: label for=txtSurname id=lblSurname Surname:span(required)/span /label input name=txtSurname type=text id=txtSurname class=inputText required / What I want to happen is when I have input two characters into the field so that it validates is to hide the span containing the word required. I cant seem to find it though! I am not sure if am am right though in using the success function with the argument label?? Can anyone see how i ould possibly get around this? I have had sucess with using the invalidHandler hiding the span but I cant hide it on only the one span at a time on the fly. Hope I explained myself! Tuppers
[jQuery] Re: jQuery Nesting Tables
Could you provide your html code generated by .net? it would help, but in general rule you don't have to check existence of an element to apply action to it. Jquery disregard the action if it doesn't exist. For your example: $('tbody[tr:last][td][table]', $(this)).remove(); will work if it can find your criteria within $(this) otherwise it does nothing. On Jul 25, 8:57 am, nullstring jayz...@gmail.com wrote: Please help? On Jul 25, 10:12 pm, nullstring jayz...@gmail.com wrote: Hi, In my last row (parent Table) with colspan(tr), I have another Table (without any.attributes) which was generated by GridView, Paging enabled and located in footer ..l How do I know if that Table exists in my last row(parent Table).. this code won't work .. if(jQuery(this).is('table')) { if(this.find('tbody tr:last td table')) { /* remove paging table element */ } }
[jQuery] Re: Multiple Phone Fields
I don't know about validte plugin, but you can easily check your condition with jquery. for example you can add the same starting id to your text fields something like txt_Phone_bus, txt_Phone_Cell, txt_Phone_Home then you can check for the value of those fields with $('imput[type=text][id^=txt_Phone_]]'.each(function(){ // apply your validation for example one of them must be $(this).val ().length0 }); On Jul 25, 8:04 am, kmac lucie.friga...@gmail.com wrote: Hi, I have a form with three text fields: Business Phone Cell Phone Home Phone One of the fields must be filled. Using jquery.validate.js how do I check for this? Thanks in advance for any help.
[jQuery] Iframe Scroll
I tried to open a iframe with a definite position. Let’s say I have an iframe like: iframe id=frame src=http://google.com; width=350 height=350/iframe And I’d like to scroll at the position X,Y of google page. I tried scrollTop, scrollLeft and even the plugin scrollTo to no avail. Can I make $(‘#frame’).scrollTo(300); or $(‘#frame’).scrollTop(200).scrollLeft(300); Any help would be appreciated. -- View this message in context: http://www.nabble.com/Iframe--Scroll-tp24646526s27240p24646526.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Jquery Ajax Postbacks
What exactly do you like to do? Ajax call do not Post back, but Call back. do you like to post back in .net application? just call the javascript __doPostBack('Yourcontrol','ypurArgument'); gladrinkz wrote: can ant one tell me or give me some shot example regarging jquery ajax post backs or related some documents it will great help for me Thanks in Advance gladrinkz -- View this message in context: http://www.nabble.com/Jquery-Ajax-Postbacks-tp24606126s27240p24608976.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: converting an html table to json
is up to you how you would like to make your json format, but you can easily loop between your table's row, and td then add the format you like. something like: var $table = $('#tableid'); $('tr', $table).each(function(i, item){ // here you can add whatever you like for each TR, then you can browse td for each tr $('td',$(this)).each(function(i,item){ // now you have all td as well }); }); nvictor wrote: hi, i'm new to jquery and i was wondering how i can use it to convert an html table into a json format. i found a lot of help for doing the reverse (json to html table) but couldn't get much help with this one. thanks a lot in advance. -- View this message in context: http://www.nabble.com/converting-an-html-table-to-json-tp24605327s27240p24609180.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Adding element to an array of object
I would like to add a key value to an object array. let's say i have 2 arrays: var parArr = new Array('par1', 'par2', 'par3', 'par4'); var valArr = new Array('val1', 'val2', 'val3', 'val4'); I would like to obtain ext={par1:val1, par2:val2,pa3:val3,par4:val4} Any help would be greatly appreciated.
[jQuery] Re: Get following rows in a table until id not match certain pattern
If i understand you correctly you can associate a click event to the table, then get the id of the TR clicked, then filter by nextAll('tr[id^=act+id - top].toggle(); something like: $('yourtable').click(function(e){ var id = $(e.target).closest('tr').attr('id'); // Then filter nextAll tr with id }); bryan rasmussen wrote: Hi, I have a situation where a user clicks on something in a particular table row which should cause all following rows in that table that have a particular format of id to toggle visibility.. so for example tr id=top11_21td # click here / td...rest of row data/td/tr tr id=act11_21_1td.../td/tr tr id=act11_21_2td.../td/tr tr id=act11_21_30td.../td/tr tr id=top11_22td # click here / td...rest of row data/td/tr when someone clicks on top11_21click it should toggle the visibility of rows act11_21_1 to act11_21_30 I would like to have this efficient, thus not just a find or filter, but rather something that gets the context of the clicked row and then loops following rows until the input does not match - any suggestions for a jquery like way of handling this? -- View this message in context: http://www.nabble.com/Get-following-rows-in-a-table-until-id-not-match-certain-pattern-tp24519653s27240p24522639.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Attaching a jQuery event to a dropdown in an ASP.net Repeater?
if your DDL has ddlSkillCategoryID as id you can select them with following selectors: $('select[id$=ddlSkillCategoryID]').change(function(){ // do your stuffs }) Dunc-4 wrote: Hi, I've got an ASP.net repeater which has an unknown number of rows, that I'm passing as a variable into the client-side code. Each repeater item has two dropdowns in it, one of which I need to attach to a jQuery event to create a cascading dropdown. I've put the change(function() { into a for..next loop, along with the target control. It's not pretty, but it seems logical. Problem I have is whenever the function is called, the ID of the target control is the max value of the loop + 1. Why is my loop variable behaving like a reference type instead of a value type? Why is it even in scope outside the loop? Alternatively, is there a better way to do this? The code: var rows = 4; // this is populated from the server code for (iLoop = 0; iLooprows; iLoop++) { $('#ctl00_repCBSkills_ctl0'+iLoop+'_ddlSkillCategory_ID').change (function() { PopulateSubSkill( 'ctl00_repCBSkills_ctl0'+iLoop+'_ddlSkillSubCategory_ID', $('#' + this.id).val() ); }); } function PopulateSubSkill(target, var) { alert(target); // always returns 'ctl00_repCBSkills_ctl05_ddlSkillSubCategory_ID' (note the 5) } Thanks in advance. Duncan -- View this message in context: http://www.nabble.com/Attaching-a-jQuery-event-to-a-dropdown-in-an-ASP.net-Repeater--tp24517510s27240p24522762.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Get the HTML of the current node plus its Inner HTML
each time that you need javascript function you can use [0] or 'this' in your case you can get it by if(this.nodeName.toLowerCase() == table) { contentHtml += this.outerHTML(); } or if have already selected your table, $table = $('selector') use $table[0].outerHTML bittermonkey wrote: Hi, I need to get all the TABLE HTML code within the body tag for a content-generating application. I'm trying to use the html() method, but it only gets the inner HTML. I also tried clone(), but does the same thing. Or maybe I'm using it wrong. Here's an example to clarify what I wanted to do: Input body psome text/p table cellpadding=0 cellspacing=0 style=width: 600px;/ table div.../div table cellpadding=0 cellspacing=0 style=width: 400px;/ table /body Output table cellpadding=0 cellspacing=0 style=width: 600px;/ table table cellpadding=0 cellspacing=0 style=width: 400px;/ table jQuery Code $(body).children().each(function(){ var contentHtml = ; if(this.nodeName.toLowerCase() == table) { //need to include the TABLE code here contentHtml += $(this).html(); } }); Thanks in advance. -- View this message in context: http://www.nabble.com/Get-the-HTML-of-the-current-node-plus-its-Inner-HTML-tp24522580s27240p24524640.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Create a Select Box
I don't know the structure of your data coming from your server, but generally speaking you should do something like : var $sel = $('select name=select_1 class=filter/select.'); now loop from your array and populate your select $sel.append($('option value='+ value + '' + text +'/option'); once you get your select compete then append it to ul $('ul#filter').append($sel); tdktan...@gmail.com wrote: So ive got a fun page where I need to create the dropdowns based on an array I pass into the html. (coming form php) However I cant figure out how to actually create a select box... I can however populate a select box that exists... Before Jquery does its stuff ul id=filter/ul So heres what I need the end to look like after jquery has run its stuff ul id=filter li id=select_1select name=select_1 class=filteroption value=11/option/select/li li id=select_2select name=select_2 class=filteroption value=11/option/select/li /ul -- View this message in context: http://www.nabble.com/Create-a-Select-Box-tp24525251s27240p24525842.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] dynamic extend
I have hard time to find out this one. I'd like to extend an object with another array. Let's say I have an array like var $copy= $('input[id$=copy]'); I would like to extend or add element to $par = {}; as following: $copy.each(function(){ $.extend($par,{$(this).attr('id'):$(this).val()} }); i have problem with the key part of the key values object. I get error string or identifier is expected. Any help would be greatly appreciated. -- View this message in context: http://www.nabble.com/dynamic-extend-tp24505460s27240p24505460.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Using jQuery to completely separate HTML from Javascript
how about # # # $('.foo').click(function(){ var par = $(this).attr('name'); // do whatever you need with name attribution }); Thierry-32 wrote: Hi, I am trying to remove every Javascript reference from my HTML data (except the inclusion headers of course). I would like some advice regarding event listeners when parameters come into play. Here is the typical example: For event handlers in HTML like: # I would have no problem replacing with the following HTML: # and Javascript code in separate file: $(document).ready( function() { $(a.foo).click(foo()); } ) However, how would you proceed when parameters are to be passed to foo ()? E.g: # # # I was thinking of something like: # # # But how to bind the foo() function (with proper parameter) using jQuery? Thanks for any recommendation/comment. Thierry -- View this message in context: http://www.nabble.com/Using-jQuery-to-completely-separate-HTML-from-Javascript-tp24467775s27240p24507040.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] First Parent Siblings
I have several following html code: h3a class=classa/a/h3div class=classdiv/div h3a class=classa/a/h3div class=classdiv/div h3a class=classa/a/h3div class=classdiv/div etc I would like toggle div.classdiv when a.classa is clicked I tried $(this).parent('h3').siblings('div.classdiv').toggle(); but all div all toggled. Any help would be greatly appreciated
[jQuery] Re: First Parent Siblings
Thank you for the reply. I would like to show hide the div located right after the h3 when a.classa is clicked, and not all other div.classdiv located on other lines. Thanks again On Jun 17, 2:19 pm, waseem sabjee waseemsab...@gmail.com wrote: do you want to toggle the class on the div or toggle a transition like slideToggle or fadeToggle ? On Wed, Jun 17, 2009 at 11:16 PM, FrenchiINLA mamali.sohe...@gmail.comwrote: I have several following html code: h3a class=classa/a/h3div class=classdiv/div h3a class=classa/a/h3div class=classdiv/div h3a class=classa/a/h3div class=classdiv/div etc I would like toggle div.classdiv when a.classa is clicked I tried $(this).parent('h3').siblings('div.classdiv').toggle(); but all div all toggled. Any help would be greatly appreciated
[jQuery] jqGrid with web service of .net framwork
Is there anyone who could work with jqGrid and web services in a asp.net project? I really try hard to just be able to call the method in my web service for no avail. I have the following in my html file: script type=text/javascript $(function() { $('#list').jqGrid({ url: 'Services/Bill.asmx/Get_Client_jqGrid' , datatype: 'xmlstring' , colNames: ['Name'] , colModel: [ { name: 'CltName', index: 'CltName', width: 55 } ] , caption: Client }); // jqGrid }); // ready /script div table id=list class=scroll /table /div And I made a web service with the following signature: [WebMethod] public string Get_Client_jqGrid() { // just some code to test the HttpContext.Current.Request.Params[] } I put a breakpoint in the web service but it’s never been called. I get jut the header with Loading message. any help would be really appreciated. I tried a grid with local data, and the edit return perfectly to another WebMethod of the web service.
[jQuery] Re: Confirming submit using Validate plugin
Add return false; in case of cancel function confSubmit(form) { if (confirm(Are you sure you want to submit the form?)) { $(#employmentForm).submit(); } else return false; -- }//End of confSubmit function On Nov 15, 3:03 pm, flycast [EMAIL PROTECTED] wrote: I have a long form where some of the fields are required. The problem is that the user is sometimes getting to the point where they have filled all the required fields in but is not done and then hits enter rather than tab to go to the next field. When they do this the form submits. I want to conform that the user really wants to submit when they hit enter. This does not work: function confSubmit(form) { if (confirm(Are you sure you want to submit the form?)) { $(#employmentForm).submit(); } }//End of confSubmit function I get a popup corectly but if I hit cancel on the confirm dialog then the form validates/submits anyway rather than returning to the form.
[jQuery] Re: Poll sumbit
I would do it this way, - on Page Load get the result from db and display it - user selection --- update db -- return the updated result -- display it On Nov 8, 12:34 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi all, I want to build something so that when someone submits his poll choise that the poll will change into the results without any refresh. Whats the best way to start of with for building this? So: - user visite the site - user chooses a option on the poll - he presses on vote - then his answer will be added to the database - poll results will show When a person already voted he also has to show the results. Whats the best way to start of with? Erwin
[jQuery] Re: Jquery Countdown!!!
Add the following in the header of your page with the correct liftoffTime value script type=text/javascript $(function() { var liftoffTime = new Date(); liftoffTime.setDate(liftoffTime.getDate() + 5); $('#listLayout').countdown({ until: liftoffTime, format: 'yODHMS', layout: 'ul%Yli%n %l/li%Y%Oli%n %l/li%O%Dli %n %l/li%D' + '%Hli%n %l/li%H%Mli%n %l/li%M%Sli%n %l/li%S/ul' }); }); /script Then in your page body add a span like span id=listLayout/span and your code should work On Nov 8, 3:30 pm, B3 [EMAIL PROTECTED] wrote: Can someone just give me some instructions to get this to work??? I don't understand how to implement this into my site... where would I put this: $('#listLayout').countdown({until: liftoffTime, format: 'yODHMS', layout: 'ul%Yli%n %l/li%Y%Oli%n %l/li%O%Dli%n %l/li %D' + '%Hli%n %l/li%H%Mli%n %l/li%M%Sli%n %l/li%S/ul'}); ??? The countdown.js and jquery.js are loading but I don't get it... and also what would I put in the html side? I got this from herehttp://keith-wood.name/countdown.html#listLayout thanks
[jQuery] Re: accessing child element without unique id
var $col = $('#row1 td') will give you a collection of all td under row1, then you can filter by first, last, or even use ordianal positon like $col[0] etc. On Nov 5, 11:59 am, Jared_T [EMAIL PROTECTED] wrote: I'm trying to access a td text value, as shown in the javascript below. The easiet way to solve this problem would be to give each td id value a unique identifier (i.e. td id=row1_col1) Is it possible to access the td element of a tr with a unique tr id tag without naming each td id uniquely? I'm new to this, I pasted the code as an example of what I'm trying to do. All the attempts in the javascript below failed. html head script src=http://code.jquery.com/jquery-latest.js;/script /head body table cellspacing=5 cellpadding=5 border=1 tr id=row1 td id=col11/td td id=col22/td /tr tr id=row2 td id=col13/td td id=col24/td /tr /tablebr / script type=text/javascript str01 = $(#row1 col1).text(); document.write(row1 col1 value is: + str01 + br /); str02 = $(#row1.col1).text(); document.write(row1 col1 value is: + str02 + br /); //str03 = $(#row1).(#col1).text(); //document.write(row1 col1 value is: + str03 + br /); //str04 = $(#col1).text((#row1).text()); //document.write(row1 col1 value is: + str04 + br /); /script /body /html
[jQuery] Re: Adding class to a parent element- traversion help?
your problem is coming from (this). just try : $(.bc-wrapper:empty).parent().addClass(none); On Sep 30, 2:09 pm, Vinoj [EMAIL PROTECTED] wrote: I've got the following as my jquery code: script type=text/javascript $(document).ready(function() { $(.bc-wrapper:empty).(this).parent().addClass(none); }); /script And the html is: div class=bottom-content div class=bc-wrapper /div /div The css is as follows: .bottom-content { display: block; width: 215px; border: 1px solid #ccc; float: left; margin-right: 20px; } .bc-wrapper { padding: 5px; } .none { visibility: hidden; border: none; } -- Basically in this example, I'd like the bottom-content class to be hidden if the bc-wrapper class has no content. Unfortunately, I believe I've written my code wrong (in all the different variations I've tried) for jQuery because nothing is happening. Even when I check with Firebug, there's no class attached anywhere. Any thoughts?
[jQuery] Re: Help with $.ajax() function
try $.getJSON since you want to get json data somthing like $(document).ready(function(){ $(#peep).click(function(){ .getJSON(url, { request:'tes',message:'SupLawl' }, function(json) { alert(json.msg); } ); }); }); On Sep 23, 6:57 pm, Bockit [EMAIL PROTECTED] wrote: Can't work this out myself so turning to others, chances are I'm missing something small, but let's see. I'm trying to use the $.ajax() function in my app, however it just isn't sending the GET data when I click on the link. $(document).ready(function(){ $(#peep).click(function(){ $.ajax({ url: http://bockit.dyndns.org:8081/peep/servlet/peep;, type: GET, dataType: json, data: request=testmessage=SupLawl, error: function(){ alert(woops); }, success: function(json){ alert(worked omg: + json.msg); } }); }); }); Could anyone take a look at that and tell me what I'm doing wrong? At the moment the server isn't even registering a request, at all. If I manually type the url into the address bar, the server gets the request, and it runs through its motions properly, so I know the problem is somewhere in that code.
[jQuery] Re: Replace html class with rel attribute into an anchor
what you need is attr. to get the value of an attribution use $ ('iframe').attr('href'); to set a rel attribute use $ ('iframe').attr('rel':'myrel'); On Sep 21, 10:12 am, Andrea - Aosta [EMAIL PROTECTED] wrote: I need to replace an attribute inside a tag a... I have this code html a href=url.html class=iframe Link/a And, for all link with iframe class, i need to have a href=iframe.html rel=myrel Link /a I have try with $(.iframe).append(rel='highslide-iframe'); but this append outside the a... I think this is better: $(.iframe).replaceWith(rel='highslide-iframe'); but how to set a replace saving the url target? Thank you
[jQuery] Re: Insert variable into a selector
i think your problem is this.id, you have to show the entire code in order for us to see what does this mean. try just to add a alert for example to see what you get for this.id On Sep 21, 7:38 am, suntrop [EMAIL PROTECTED] wrote: HI there, I want to insert two variables into the selector and an attribute. But it doesn't work. $('h1 a#' + this.id + ' img').attr({src : images/ + msg + .png}); I looked through various tutorials but couldn't find an answer to this. The first variable comes from the object's (a element) id and the seccond is a response from an php script. Can somebody please help me?
[jQuery] Re: can i use livequery with greybox2 or equivalent?
You can use livequery to attach events to your elements whenever they are built. something like the following should worrk for you. $('.pageWindow').livequery(function(){ // Add here what you would like to do with the new pageWindow class }); On Sep 17, 12:32 pm, onmountain [EMAIL PROTECTED] wrote: Hi. I am using greybox2 plugin to generate a modal window with details of items when I click on their hyperlink, identified by the class= . However, I am also adding more such hyperlinks with teh same class= on the fly, and I need to rebind the elements correctly. Can I use livequery to do this, or do I need to do it another way? This is what my code looks like: $(document).ready( function(){ var gbOptions = { gbWidth: 400, gbHeight: 400, captionHeight: 22 }; $('.pageWindow').greybox(gbOptions); // for item info opening in modal wondow blah blah blah --- Can I use livequery like something like this ( This doesn't work)?: $('.pageWindow').livequery('click', $('.pageWindow').greybox(gbOptions); ) // for item info opening in modal wondow }); - Thanks, Jamie
[jQuery] Re: Image Button Acts Like Submit Button for JQuery Call
try something like: $('.delrow.)hover($(this).attr({'src':'images/rowOverDel.png'}), $ (this).attr({'src':'images/rowOutDel.png'}) ) .click(function(e){ e.preventDefault(); // Do your click event delete row etc return false; }); On Sep 17, 10:53 am, rcflyer2005 [EMAIL PROTECTED] wrote: On my web page, I have two image button to dynamically add or delete a row of data in a table. When I click the buttons, they submit the form and execute the action=justDoIt.php on the form tag and not call jquery. Is there any way this can be fixed. I'm using IE6 8 beta. I have to stick with IE for now because I have vbs. Thanks loads! Marv. These two buttons work, but are very ugly: input type=button value=del class=delrow/ -- input type=button value=add class=addrow id=addrow/ I would like to get these two buttons to work: divtd input type=image class=delrow src=images/rowOutDel.png onmouseout= this.src=images/rowOutDel.png onmouseover=this.src=images/rowOverDel.png onmousedown=this.src=images/rowDownDel.png / input type=image class=addrow src=images/rowOutAdd.png onmouseout= this.src=images/rowOutAdd.png onmouseover=this.src=images/rowOverAdd.png onmousedown=this.src=images/rowDownAdd.png / /td/div
[jQuery] Re: $.ajax isn't parsing JSON object properly
are you using .net 3.5? in this casse try the following: success: function(rdata) { var obj = rdata.d; for some security reason web service make this way the JSON object On Sep 12, 8:31 am, Namlet [EMAIL PROTECTED] wrote: I'm trying to digest a JSON object returned from an ASP.NET Webservice. I'm not sure if my problem is on the ASP.NET side, or the JavaScript side, but I could use some guidance. This code: $.ajax({ type: POST, contentType: application/json; charset=utf-8, url: xxx, data: {'guid':'{85FDC9B6-C20C-4007-9AA8-AE7B62FC0309}'}, dataType: json, success: function(rdata) { //var str = eval(rdata); $(body).append(rdata); //alert(rdata); } }); Produces this: {guid : 85fdc9b6-c20c-4007-9aa8-ae7b62fc0309,person_id : 558311,fname : Nkulu,mname : Ntanda,lname : Ntambo,prefix : Bishop,suffix : ,relation : Jr.,ethnicity_code : AA,gender : M,conference_id : 68,bm_age_cat : MA,addr_address_id : 32555,addr_address1 : United Methodist Church,addr_address2 : P.O. Box 20219,addr_city : Kitwe,addr_state_code : ,addr_zip_code : ,addr_country_code : ZAM,wk_phone_id : 15296,wk_country_code : 243,wk_city_code : 970,wk_area_code : ,wk_phone : 29-004,wk_ext : 555,fax_phone_id : 16157,fax_country_code : 243,fax_city_code : 971,fax_area_code : ,fax_phone : 08-9792,home_phone_id : 32978,home_country_code : 222,home_city_code : 333,home_area_code : ,home_phone : 444-,cell_phone_id : ,cell_country_code : ,cell_city_code : ,cell_area_code : ,cell_phone : ,email_id : 4003,email_address : [EMAIL PROTECTED],education : ,recvd_loan : False,grad_umcscu : False,grad_instit : ,umc_scu_trustee : False,trustee_instit : ,emp_church_name : ,pres_posit : ,assist_name : ,church_memship : ,church_size_id : ,loc_chur_respon : ,ann_conf_respon : ,gen_chur_respon : ,add_info : ,spec_needs : } While this code: $.ajax({ type: POST, contentType: application/json; charset=utf-8, url: xxx, data: {'guid':'{85FDC9B6-C20C-4007-9AA8-AE7B62FC0309}'}, dataType: string, // --- success: function(rdata) { //var str = eval(rdata); $(body).append(rdata); //alert(rdata); } }); Produces this: {\guid\ : \85fdc9b6-c20c-4007-9aa8-ae7b62fc0309\,\person_id\ : \558311\,\fname\ : \Nkulu\,\mname\ : \Ntanda\,\lname\ : \Ntambo\,\prefix\ : \Bishop\,\suffix\ : \\,\relation\ : \Jr.\,\ethnicity_code\ : \AA\,\gender\ : \M\,\conference_id \ : \68\,\bm_age_cat\ : \MA\,\addr_address_id\ : \32555\, \addr_address1\ : \United Methodist Church\,\addr_address2\ : \P.O. Box 20219\,\addr_city\ : \Kitwe\,\addr_state_code\ : \\,\addr_zip_code\ : \\,\addr_country_code\ : \ZAM\, \wk_phone_id\ : \15296\,\wk_country_code\ : \243\, \wk_city_code\ : \970\,\wk_area_code\ : \\,\wk_phone\ : \29-004\,\wk_ext\ : \555\,\fax_phone_id\ : \16157\, \fax_country_code\ : \243\,\fax_city_code\ : \971\, \fax_area_code\ : \\,\fax_phone\ : \08-9792\,\home_phone_id \ : \32978\,\home_country_code\ : \222\,\home_city_code\ : \333\,\home_area_code\ : \\,\home_phone\ : \444-\, \cell_phone_id\ : \\,\cell_country_code\ : \\,\cell_city_code \ : \\,\cell_area_code\ : \\,\cell_phone\ : \\,\email_id \ : \4003\,\email_address\ : \[EMAIL PROTECTED],\education \ : \\,\recvd_loan\ : \False\,\grad_umcscu\ : \False\, \grad_instit\ : \\,\umc_scu_trustee\ : \False\,\trustee_instit \ : \\,\emp_church_name\ : \\,\pres_posit\ : \\, \assist_name\ : \\,\church_memship\ : \\,\church_size_id\ : \\,\loc_chur_respon\ : \\,\ann_conf_respon\ : \\, \gen_chur_respon\ : \\,\add_info\ : \\,\spec_needs\ : \\}; It looks properly formatted to me, but maybe I'm missing something. Regardless, I cannot access any properties of the object. I would greatly appreciate any help. Thanks!
[jQuery] Re: How to select all input elements but the button one?
how about: $('input:not[type=submit], input:not[type=button] ') On Sep 9, 12:00 pm, aldomatic [EMAIL PROTECTED] wrote: I'm trying to select all input elements but the submit or button. I appreciate the help. Aldo
[jQuery] Re: Cancel .toggle() when a link is clicked
to make id simple i add an 'notoggle' id to your link you can use the following code: $('#toggle').click(function() { alert('toggle'); }); $('#notoggle').click(function() { alert('No Toggle'); return false; }); or if you don't want use id for the link $('#toggle a') instead of $('#notoggle'). div id=toggle Click here for more info a id=notoggledo something/a /div On Sep 9, 12:41 pm, jtibbetts [EMAIL PROTECTED] wrote: How do you stop .toggle() from toggling an object when a link (or any object) inside the object is clicked. Here's a quick contrived example: div id=toggle Click here for more info a onClick=DoSomething();do something/a /div div id=infoblah blah blah.../div script $(#toggle).toggle( function () { $(#info).show(); }, function () { $(#info).hide(); } ); /script Clicking on the toggle div toggles the info div. If the do something link is clicked, the toggle div will toggle *and* DoSomething() will be called. I want to be able to click the do something link and only have DoSomething() trigger but not cause the div to toggle. Is this possible? (Forgive the code if it's wrong, but I just whipped it up on the fly)
[jQuery] Re: Selecting a checkbox by clicking anywhere on a row
Try the following code: $('.myrow').children().click(function() { if ($(this).children('[EMAIL PROTECTED]').length == 0) { var check_id = '#' + $(this).parent().attr('id') + 'checkbox'; $(check_id).attr('checked', !$(check_id).attr('checked')); } }); On Sep 8, 8:55 am, Michael Smith [EMAIL PROTECTED] wrote: Hi there, I'm trying to make a page which automatically toggles a checkbox when you click anywhere on the row. Here's a version I've cut down to the bare bones to illustrate http://dev.savingforchildren.co.uk/mjs/row_select.epl It seems to work fine unless the user actually clicks on the checkbox itself. In this case it seems that it actually gets toggled twice and so reverts to its original state. Any suggestions on the cleanest / simples way to avoid this? (I can think of a few messy ways) Thanks Michael
[jQuery] Re: .unbind hover doesn't work
Have you tried hover event? $(#nav1).hover(function(){},function()); $(#nav1).unbind('hover'); On Sep 5, 12:51 pm, Namlet [EMAIL PROTECTED] wrote: To unbind the above example use: $(#nav1).unbind('mouseenter mouseleave'); This is what the documentation says, but it doesn't remove the hover event. Do I have to do something else? Thanks.
[jQuery] Re: Add a class only to the first parent
$('.menu:first').addClass(bar); On Aug 24, 3:24 pm, Massimiliano Marini [EMAIL PROTECTED] wrote: Hi all, I need some help, I want to apply a class with 'addClass' at all li of the first ul class=menu and not to the second Example: div id=foo ul class=menu!-- first -- li1/li li2/li li class=expanded ul class=menu!-- second -- li3/li li4/li /li /ul /div How can I achieve this? Is possible without using the each() function? Any help, suggestions, examples are welcome. -- Massimiliano Marini -http://www.linuxtime.it/massimilianomarini/ It's easier to invent the future than to predict it. -- Alan Kay
[jQuery] Re: Best way to toggle a form field value
$('a').click(function(){$('input[name=' + this.id+ ']').val(!$ ('input[name=' + this.id+ ']').val())});// On Aug 21, 7:02 am, Andy Matthews [EMAIL PROTECTED] wrote: I'm storing a boolean in a hidden field, and I'd like to flip it's value when someone clicks a link. Here's the function I've got currently: function toggleInput($el) { // get the ID of the element being passed in var id = $el.attr('id'); // get form element var $formEl = $('input[name=' + id + ']'); // get the current value of the selected form field var value = $formEl.val(); // set the new value $formEl.val(!value); alert(value); } I seem to recall a way to invert the value in one line, but it's eluding me at this time. Can someone help me out? Andy Matthews Senior ColdFusion Developer Office: 615.627.9747 Fax: 615.467.6249www.dealerskins.comhttp://www.dealerskins.com/ Total customer satisfaction is my number 1 priority! If you are not completely satisfied with the service I have provided, please let me know right away so I can correct the problem, or notify my manager Aaron West at [EMAIL PROTECTED] 2008 Email NADA.jpg 17KViewDownload
[jQuery] Re: how to toggle text
have you tried just $(#toggle-content).toggle(); it shows and hide toggle-content div. otherwise for more option you can use $(#toggle-content).toggle(function1(){},function2(){}); where function1 will run when first clicked and function2 the second time. On Aug 19, 10:44 am, elz64 [EMAIL PROTECTED] wrote: Hello, I begin with jQuery so looks like one toggle function is missing : how can be accomplished the change of a text in a link , (and it's title or a alt text) between to possible states : ie: I use this to hide/display a content div a linl and this : $(#toggle-content).click(function(){ $(#contenu).toggle(); $(#toggle-content).toggleClass(ouvert); this will add a class to the link #toggle-content to make it when closed (default) or .ouvert when opened. BUT the link remains the same, and it's actually not very cool or accessible to display something like read more when it's already opened, and the text should be now click here to hide Of course, dealing with toggleClass, it's possible to use a full graphic background-image that tells the right stuff, but the title AND the alt of the link must be change anyway. any one had already done this ? Thank you.
[jQuery] nyroModal dynamic href question
I use nyroModal and is very nice and really easy for basic use. What I would like to do is for each link I have to get the href, width, and high from database and apply to the setting of the link. Let’s say I have the following html code ”#” blablala I tried something like $('a.nyro').click(function(e){ e.preventDefault(); CallWebServicetoGetJsonObject($(this).attr('id'), function(obj) { alert('h : ' + obj.H + 'W : ' + obj.W + 'Href : ' + obj.URL); -- OK i get the correct values $.fn.nyroModalManual({height:obj.H,width:obj.W,href: adio.URL}) } ); }); but i don't get any modal form. Of course it works great if i add the heref to the tag. any help would be greatly appreciated. -- View this message in context: http://www.nabble.com/nyroModal-dynamic-href-question-tp17808281s27240p17808281.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: jQuery help
Can you post at least your html code. to see how your page is made. if i understand you corretly you want to copy value of text box (UID value) to a div You can always start by coding somethign like $('#div').htm($('#txt').value();) now i don't know by which event you want to trigger this action. Chasery wrote: I am having some serious problems with what should be some easy scripting. I am looking to talk to some one over an instant messenger that could help guide me through what I am trying to do. What I am looking to do is take user input and display it in a div next to it. At that time I would also like another div to open. aim - Billhillydude2k msn - [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/jQuery-help-tp17806822s27240p17809771.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: jQuery help
Check this out. http://www.pengoworks.com/workshop/jquery/field/field.plugin.htm#examples jQuery Field Plug-in will give you all filed values in your form now associate click event to yuor button like $(function(){$('#btn').click(function(){$('#divID').htm($('#formName').formHash(););})}); make this works then we'll see for ajax part FrenchiInLA wrote: Can you post at least your html code. to see how your page is made. if i understand you corretly you want to copy value of text box (UID value) to a div You can always start by coding somethign like $('#div').htm($('#txt').value();) now i don't know by which event you want to trigger this action. Chasery wrote: I am having some serious problems with what should be some easy scripting. I am looking to talk to some one over an instant messenger that could help guide me through what I am trying to do. What I am looking to do is take user input and display it in a div next to it. At that time I would also like another div to open. aim - Billhillydude2k msn - [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/jQuery-help-tp17806822s27240p17810366.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: .load Ajax et Jtip ou ClueTip
tu peux de la meme maniere travailler avec jtip par example. Make Handler.ashx?Action=totoetc=etc essaye d'utilise un httphandler au lieu de aspx, and pass tes parametre, et return htm, or juste textefile. si tu loader une page avec des server controles tu aura des probleme avec 2 form runat=server dans la page. autrement pour montrer des tooltips c'est tres simple de realiser avec jtip. j'ai une page qui est fait avec ce que tu veux check http://Soheyli.com/PersianTV.aspx Discret wrote: Bonjour, J'utilise .load pour charger l'id d'une page dans l'id d'une autre page. http://docs.jquery.com/Ajax/load code script $(document).ready(function(){ $(a.article).click( function (){ $(#feeds).load(Pagedarticle.aspx #conteneur);}) }); /script ul li # Charge la page et l'id conteneur dans l'id feeds /li /ul div id=feeds/div /code Ok c'est rudimentaire mais ça marche, je souhaiterais pouvoir faire de même avec un Plugin comme [Jtip-http://www.codylindley.com/blogstuff/ js/jtip/]., [Cluetip-http://plugins.learningjquery.com/cluetip/demo/] ou autre. C'est à dire charger l'élément id d'une page externe dans le div façon Jtip au passage de la souris sur un lien ? Auriez vous une idée pour m'aider ? Merci Discret -- View this message in context: http://www.nabble.com/.load-Ajax-et-Jtip-ou-ClueTip-tp17779291s27240p17788552.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Jquery effects Issue with multple ID targets
Can you Post your code? anyway $(this) gives you the DIV as Jquery object inside of click event. Put the same class to all your div and use some code like: $(.yourclass).click(function(){$(this).dosomthing();}); Auriion wrote: Hi, I have 3 div's on the screen that I've also added click events to. These click events simply make the div you click fade out, and a corresponding div fade in. Now the problem is, after double checking my ID targets and experimenting with different combinations, that only the very last div I set to appear actually appears. To further the confusion, if you click the other 2 non-corresponding divs, it makes only that last one appear and disappear in the same way. Any thoughts? I'm completely stumped. I've even re-built the effect using scriptaculous with the exact same bug happening. Thanks in advance. -- View this message in context: http://www.nabble.com/Jquery-effects-Issue-with-multple-ID-targets-tp17364584s27240p17367653.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Jquery effects Issue with multple ID targets
I did not check the CSS but as for Jquery code: you can regroup your DIV like following: div class=absoluteCenter id=closedChatBubbleA p ../images/closedChatBubbleA.png /p p ../images/expandedChatBubbleA.png /p /div $(.absoluteCenter).click(function(){ $this = $(this); $this.children(.closedChatBubbleA) gives you the span closed as jquery object and you can fadein, hide it ,or do whatever you like to do the same thing for expandedChatBubble and this code is for all your 3 divs. }); Auriion wrote: Here is a link to what I'm actually working on at the moment. http://206.196.101.53//magnacaretemplates/prototypes/chatBubble.html You can just look at the source, it's pretty simple. I'm using a css technique to get the divs to position in relation to the center of the document. I don't think that has anything to do with my issue though. Thanks for responding. FrenchiInLA wrote: Can you Post your code? anyway $(this) gives you the DIV as Jquery object inside of click event. Put the same class to all your div and use some code like: $(.yourclass).click(function(){$(this).dosomthing();}); Auriion wrote: Hi, I have 3 div's on the screen that I've also added click events to. These click events simply make the div you click fade out, and a corresponding div fade in. Now the problem is, after double checking my ID targets and experimenting with different combinations, that only the very last div I set to appear actually appears. To further the confusion, if you click the other 2 non-corresponding divs, it makes only that last one appear and disappear in the same way. Any thoughts? I'm completely stumped. I've even re-built the effect using scriptaculous with the exact same bug happening. Thanks in advance. -- View this message in context: http://www.nabble.com/Jquery-effects-Issue-with-multple-ID-targets-tp17364584s27240p17367675.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Problem of show and hide when I have several DIV and one only has to be affected
you need to get the sibling of your see-more class somethig like : $(this).siblings(.news_complete)slideDown(1000); should work for you On Apr 1, 9:04 pm, Brandnew [EMAIL PROTECTED] wrote: Hello, I hope I'm more or less clear in my title. I have this problem : I have several DIVs which contains different infos (the content of them is coming from a DB). Exemple : div class=news a class=see_more href=See more/a CONTENT CONTENT div class=news_complete style=display:none; HIDDEN CONTENT HIDDEN CONTENT /div /div When i click on See more, I have a small Jquery command : $(document).ready(function(){ $('.see_more').click(function(){ $('.news_complete').slideDown(1000); return false; }); }); So basically, the user is able to choose if he wants to see the complete content of one DIV. My problem is that with the way I coded it, when I click on the link See more, it opens all my DIV where there is a 'class=news_complete', not just the one where I clicked See more. I tried several different options, using ID and class, trying to have an attribute in the DIV with the ID of the news. But nothing works so far. Could you help me to finish that ? Thank you a lot ! Ced
[jQuery] Re: update a select field by ajax
you can add another option ot your ajax call -- success: function(msg) { } -- the msg is the code returned from your server. you also need to take away onchange=load_select() from select tag. On Mar 25, 11:27 am, jojolapin [EMAIL PROTECTED] wrote: Hi that is the first time I use the Ajax functionality of JQuery and I face so many problem. I meant that to update my select field by Ajax I need to do it by this way: $(#myId).change(function () { $.ajax({ url: ajaxCallback.php, cache: true, type: GET, data: param=toto, dataType: html }); }); My php page display the complete field so: select name=myId onchange=load_select() class=disable id=myId option value=1Option 1/optionoption value=2option 2/option /select What could I change to update the field with the one wich has been generated please?
[jQuery] Re: tabs: possible to save a form when switching tabs?
if you use the click event of tab it pass 3 parameters Tab clicked, Tab toShow, TabtoHide so you can write something like var $tabs = $('#foo).tabs({click: function(clicked, toShow, toHide) { var title = toHide.title; . }); On Feb 14, 6:28 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks, but let me throw in an additional wrinkle. Let's say there are three tabs, with titles Properties, General, and Misc and you are on tab General and then click on tab Misc. The below functionality would get called, even though it is only supposed to be called if you are leaving the Properties tab. Any way to adjust the below for this situation? - Dave On Feb 14, 6:05 pm, Klaus Hartl [EMAIL PROTECTED] wrote: On Feb 14, 9:25 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks, Klaus. I only want to run this form validation if a user is leaving the tab with a.title = Properties. How do I screen for that prior to executing the function? - Dave var $tabs = $('#foo').tabs().bind('select.ui-tabs', function(e, ui) { if (ui.tab.title.toLowerCase() != 'properties') return validateForm( $('#tabcontent div.ui-tabs- container:visible form')[0] ); }); --Klaus- Hide quoted text - - Show quoted text -
[jQuery] Re: Selector Containing Variable
you can try $('#' + tabtext) since the id is unic you don't need the class. On Jan 30, 7:24 am, studiobl [EMAIL PROTECTED] wrote: I'm having trouble with a jQuery selector that contains a variable. I'm trying to target an element that has a class of orderInfo and an id of billy So, I set a variable: var tabText = billy; ...and it works if I use the string: $(.orderInfo[id='billy']; ...but not the variable: $(.orderInfo[id=tabTest]; ...but of course I need it to work with a variable {insert appropriate emoticon here}
[jQuery] Block UI doesn't show at the second click
I really don't understand why the following code doesn't work . I used BlockUI plugin in another page without t any problem but in this page event he simple case does not work the second click. The html code is: input ID=btn type=button value=Button class=button2 name=div / div id=div style=display: none; cursor: default; background- color: #dd; border-style: solid; z-index: 300; p Bla bla bla:/p br / p style=text-align: center; input class=cancel id=Button21 type=button value=Cancel / /p /div $( function() { $('.button2').click( function() { $.blockUI($('#div')); } );// button2 click $(.cancel).click( function() { $.unblockUI($('#div')); } );// Cancel Click }), When the button is clicked the div is shown and after cancel is clicked the div is unblocked, but if I click again the page is blocked but the div is not shown. Any help would be greatly appleciated.
[jQuery] Re: Block UI doesn't show at the second click
Thak you mike, let me present the whole scenarii. I have several buttons wich should block a section with different div I add the ID of the div in Button Name, and made the following code: $( function() { var $div; $('.button2').click(function() { $div = $('#' + $(this).attr('name')); $('#tdPlayer').unblock().block($div); }); $('.cancel').click( function(){ $('#tdPlayer').unblock(); }); }); for the same result is it a way to make the page that I described it thanks again for your reply. On Jan 20, 9:35 am, Mike Alsup [EMAIL PROTECTED] wrote: When the button is clicked the div is shown and after cancel is clicked the div is unblocked, but if I click again the page is blocked but the div is not shown. Any help would be greatly appleciated. Try this: $(function() { var $div = $('#div'); $('.button2'.click(function() { $.blockUI($div); $('.cancel').click($.unblockUI); }); }); The problem that you are having is that when you invoke unblock, the blocking element is removed from the DOM. Which means the next time you do $('#div') you won't find the element. But if you cache it first you can use it over and over. Note however, that you need to rebind the click handler to the cancel button because event handlers are removed automatically by jQuery. Mike
[jQuery] .net 2 web services json
Asp.net 2 :I would like to post to a web service and get the result as json format. The method is decorated with [ResponseFormat=ResponseFormat.Json)]and it return a simple class. When I use prototype code like : asmxFile.MethodName( par1, par2,function(obj){}); the obj is json format, but If I use $.post(asmxFile/MethodName, {par1:val1, par2:val2}, function(obj) {}); the obj is not json format but has xml, and text properties containing all json memebers. What else shuld I add to my call to get json format. I tried getJson but it doesnùt call my web services. Any help would be greatly appreciated:
[jQuery] Re: ClueTip - local content without attribute
I haven't test it but it makes sense to me. $('.green').cluetip(#msg1); On Dec 7, 1:46 pm, rolfsf [EMAIL PROTECTED] wrote: I'm using ClueTip, and loading the content from some hidden divs using the default rel attribute. Is there a way I can do this without using the rel attribute? For example: I have some cells in a table: td class=greena href=blah99/a/td td class=reda href=blah99/a/td and some hidden divs: div id=msg1this is green/div div id=msg2this is red/div If I hover over an anchor inside a td with class=green, then I want to grab the content from div#msg1. Can I do this without having to add rel=#msg1 to every green anchor? Thanks!
[jQuery] newbie question
I have a javascript function like MyFunc(btn), and I would like to associate a click event to all my button with button1 class in the page to this function. I tried the following code and is not working for me: $([EMAIL PROTECTED]'button'].button1).each(function() { this.click(function(){MyFunc(this);}); }); what's wrong with my code? any help would be greatly appreciated.