[jQuery] iterating functionality
Hi all I have a simple hide/show function that doesn't seem to work the way I want. I need some theory help here. Currently in my code I have a loop that iterates over a block of code and builds a table. I have a two row relationship. Row one tr is important info, where row two tr has the break out info that can be shown by clicking some text in row one.. I have a jquery hide/show function that also iterate over in the loop (you see where i am going with this). So this code repeats itself over and over to the end of the loop as needed. I would like to have one copy of this code at the top of my page instead of duplicating it over and over. but how would i do this? Frank
[jQuery] Explaining this or .this or .this()
There is a concept I am struggling with and I am not sure how to approach it. I am trying to understand: .this I don't know if an explanation or an example would be best. But I want to understand it. I have tried to read an explanation and it doesn't make sense. Can someone help me? Frank
[jQuery] Re: Explaining this or .this or .this()
So then it pulls part of a function? Is 'this' in the example you made pulls $(div) or $(div).each Frank On Nov 29, 12:38 pm, Josh Nathanson [EMAIL PROTECTED] wrote: I'll give it a shot...and please gurus correct any mistakes here...this refers to the object context within which it is referenced at runtime. So, if you have a bunch of divs: $(div).each(function() { console.log(this); }); You will see in the console each of the divs as it loops over them. Every javascript function runs within the context of some object -- at the highest level this is the window (global) object. To understand context and scoping better, I highly recommend checking out John Resig's book Advanced JavaScript Techniques, it cleared up a lot of confusion for me. -- Josh - Original Message - From: FrankTudor [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Thursday, November 29, 2007 8:14 AM Subject: [jQuery] Explaining this or .this or .this() There is a concept I am struggling with and I am not sure how to approach it. I am trying to understand: .this I don't know if an explanation or an example would be best. But I want to understand it. I have tried to read an explanation and it doesn't make sense. Can someone help me? Frank
[jQuery] Re: Explaining this or .this or .this()
I fell like I could get this concept. I'm close. I think I need to create something, but i don't no 'this' so I don't know how to use it. Does that example work that you posted...where does it log? to the current directory? I can't 'write' or 'create' in the environment i working. Could you maybe work the example so that it outputs to the screen. I can make a sample file with 'div' tags point to my jquery.js file. I have done jquery scripts without the 'this' part and I would attempt to change it but 'this' is a stumper for me. Frank On Nov 29, 1:42 pm, Josh Nathanson [EMAIL PROTECTED] wrote: So then it pulls part of a function? Is 'this' in the example you made pulls $(div) or $(div).each It doesn't pull part of a function...it pulls the object within which the function is executing. In my example, the function is each, and the object within which it is executing is the jQuery object (which is an array of div elements) returned by $(div). So, this would refer to the current div element which is being iterated. It's not easy to wrap your mind around it, it definitely takes some time and experimentation to see how it works. -- Josh - Original Message - From: FrankTudor [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Thursday, November 29, 2007 11:32 AM Subject: [jQuery] Re: Explaining this or .this or .this() Frank On Nov 29, 12:38 pm, Josh Nathanson [EMAIL PROTECTED] wrote: I'll give it a shot...and please gurus correct any mistakes here...this refers to the object context within which it is referenced at runtime. So, if you have a bunch of divs: $(div).each(function() { console.log(this); }); You will see in the console each of the divs as it loops over them. Every javascript function runs within the context of some object -- at the highest level this is the window (global) object. To understand context and scoping better, I highly recommend checking out John Resig's book Advanced JavaScript Techniques, it cleared up a lot of confusion for me. -- Josh - Original Message - From: FrankTudor [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Thursday, November 29, 2007 8:14 AM Subject: [jQuery] Explaining this or .this or .this() There is a concept I am struggling with and I am not sure how to approach it. I am trying to understand: .this I don't know if an explanation or an example would be best. But I want to understand it. I have tried to read an explanation and it doesn't make sense. Can someone help me? Frank
[jQuery] toggle hide show function not working (code provided)
script type=text/javascript $(document).ready(function(){ $('.bang').hide(); $(a.collapse).toggle(function() { $('.bang').show(); $('a.collapse').remove((-)).append((+)); },function(){ $('.bang').hide(); $('a.collapse').remove((+)).append((-)); }); }); /script head body a href= class=collapse(-)/a div class=bang Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean at magna nec erat tincidunt sollicitudin. Phasellus eu est. Aenean diam elit, laoreet sed, suscipit eget, hendrerit vel, lorem. Suspendisse nec turpis ullamcorper urna accumsan sollicitudin. /div Can someone put a set of eyes on the above code...It doesn't seem to work and I am not sure why. Thanks, Frank
[jQuery] Re: toggle hide show function not working (code provided)
Thanks for straighting that out. Frank On Nov 21, 12:49 pm, mdrisser [EMAIL PROTECTED] wrote: The problem is that .remove() removes the actual element not the text inside of it. This works: $(a.collapse).html((-)); On Nov 21, 10:35 am, FrankTudor [EMAIL PROTECTED] wrote: script type=text/javascript $(document).ready(function(){ $('.bang').hide(); $(a.collapse).toggle(function() { $('.bang').show(); $('a.collapse').remove((-)).append((+)); },function(){ $('.bang').hide(); $('a.collapse').remove((+)).append((-));}); }); /script head body a href= class=collapse(-)/a div class=bang Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean at magna nec erat tincidunt sollicitudin. Phasellus eu est. Aenean diam elit, laoreet sed, suscipit eget, hendrerit vel, lorem. Suspendisse nec turpis ullamcorper urna accumsan sollicitudin. /div Can someone put a set of eyes on the above code...It doesn't seem to work and I am not sure why. Thanks, Frank
[jQuery] tinyMCE jquery equivalent
Hi all I am looking for a tinyMCE jquery equivalent (if one exists)... Thanks, Frank
[jQuery] hide/show (trying to prevent inline loop code)
Hi all, I an trying to create a simple hide/show toggle with jQuery, but My content loops over a query and so when I test it it opens all my table blocks (since they have Identical code duplicated to the length of the records). So then I got cleaver and created a variable that generates a random number every time the code iterates the loop. But then I have all these copies of something that needs to be only created once. So would other people manage this? Thanks, Frank
[jQuery] Re: hide/show (trying to prevent inline loop code)
I'm sorry I won't be able to post my code till tonight... But I can sudo code it here: Note: I use coldfusion... (Starting loop) cfset letEmRide = randomize(, ) Picking a random number script $(documnet).ready(Function) { $(.collapseThisPuppycfoutput#letEmRide#/cfoutput).hide(); $(clickercfoutput#letEmRide#/cfoutput).click(function() { $('.collapesThisPuppycfoutput#letEmRide#/cfoutput').toggle(400); return false; }); }); /script a href= class=clickercfoutput#letEmRide#/cfoutputHide/Show Toggle/a div class=collapesThisPuppycfoutput#letEmRide#/cfoutput Content /div (iterating or ending loop) Frank On Nov 19, 9:26 am, Priest, James (NIH/NIEHS) [C] [EMAIL PROTECTED] wrote: I'm working on something similar - can you post your HTML and jQuery code?? Here's my thread:http://groups.google.com/group/jquery-en/browse_thread/thread/4c30c5ae19 ce901c/d6be93a0dd4fc205?lnk=gstq=hiding+checkbox#d6be93a0dd4fc205001 Jim -Original Message- From: FrankTudor [mailto:[EMAIL PROTECTED] Sent: Monday, November 19, 2007 10:16 AM To: jQuery (English) Subject: [jQuery] hide/show (trying to prevent inline loop code) Hi all, I an trying to create a simple hide/show toggle with jQuery, but My content loops over a query and so when I test it it opens all my table blocks (since they have Identical code duplicated to the length of the records). So then I got cleaver and created a variable that generates a random number every time the code iterates the loop. But then I have all these copies of something that needs to be only created once. So would other people manage this? Thanks, Frank
[jQuery] Re: tinyMCE jquery equivalent
Thank you I am going to try WYMediator (I want to stay with a jQuery solution) just to stay uniform, although I have used TinyMCE on several projects and it is a solid solution. Frank On Nov 19, 10:26 am, Jake McGraw [EMAIL PROTECTED] wrote: FYI tinyMCE w/ plugin based GZip, I was able to get the entire library down to 46KB for the limited subset of functions I was using. - jake On Nov 19, 2007 11:23 AM, Gordon [EMAIL PROTECTED] wrote: There is WYMeditor, but last time I saw it in action it wasn't nearly as powerful as TinyMCE. I don't think there's any particular reason why the two scripts wouldn't play nicely though, is there any particular reason you want a jQuery based editor? On Nov 19, 2:46 pm, FrankTudor [EMAIL PROTECTED] wrote: Hi all I am looking for a tinyMCE jquery equivalent (if one exists)... Thanks, Frank
[jQuery] jquery code snippit improvement request
Here is a bit of code that on page load sets the alternating color of a table. Then there is a table sort tool that loads as well. The th (header) clicks cause the nice alternating line colors to sort as well. So I created this, which works perfect, but it looks clunky/repetitive.. I was thinking about wrapping an if statement in here somewhere, or maybe there is something else other people can think of. script type=text/javascript $(document).ready(function() { $('tbody.bevker tr:odd').removeClass(); $('tbody.bevker tr:even').removeClass(); $('tbody.bevker tr:odd').addClass('row0 odd'); $('tbody.bevker tr:even').addClass('row1 even'); $('th').click(function() { $('tbody.bevker tr:odd').removeClass(); $('tbody.bevker tr:even').removeClass(); $('tbody.bevker tr:odd').addClass('row0 odd'); $('tbody.bevker tr:even').addClass('row1 even'); return false; } ); } ); /script
[jQuery] tablesorter AND hide/show toggle in table
There might not be a solution for this out thiere, but I have thrown tablesorter 2.0 on a table that has rows that are initially hidden. Of course those hidden elements get sorted and end up at the bottom of the table. So I am wondering if table sorter can ignore every other row, or if there is something else I could do to keep the data in proximity to the hide/show toggle switch? Any ideas would be helpful. Frank
[jQuery] tablesorter and tr odd even coloring problem
Hi all, I have a table built dynamically (serverside). I have table sorter on the table and when I sort it sorts the colors or the rows as well. It is very irritating and I am not sure how to correct it. I tried repopulating the class via jquery labeling each odd and even but siince the page doesn't post back it doesn't hold past the first page load. Here is a sample snippet of my code: script type=text/javascript $(document).ready(function() { $('.becker tbody tr:odd').removeClass(); $('.becker tbody tr:even').removeClass(); $('.becker tbody tr:odd').addClass('row0 odd'); $('.becker tbody tr:even').addClass('row1 even'); } ); /script table class=ricTable width=70% attributes id=tablesorter-demo class=tablesorter ric:input='yes' thead tr th class=slupdiv align=left style=color: #ccReps ID/ div/th th class=slupdiv align=left style=color: #ccFolder ID/ div/th th class=slupdiv align=left style=color: #ccDate Submitted/div/th th class=slupdiv align=left style=color: #ccCity/ div/th th class=slupdiv align=left style=color: #ccState/ div/th th class=slupdiv align=left style=color: #ccApproval Request/div/th th class=slupdiv align=left style=color: #ccAttachments/div/th /tr /thead !---cfdump var=#findApvls#--- tbody class=becker Any suggestions would be very helpful...
[jQuery] good but could be better blur() form submit
Hi guys/gals, Here is a snip of code I was testing for a part of my application. It is very neat but doesn't meld well with my other session stuff. Basically if you remove focus from the text box using blur(), it submits the form and sets the Coldfusion variable. Take a look and see if this could be improved or altered to work better... script src=js/jquery.js type=text/javascript/script script $(document).ready(function() { $('.binky').blur(function() { $(form).submit(); } ); } ); /script cfif isdefined(form.asdf) and form.asdf neq cfset session.comments = form.asdf cfoutput#session.comments#/cfoutput /cfif cfform action= method=post name=asdf cftextarea class=binky name=asdf cols= rows=/cftextarea /cfform
[jQuery] need a simple jquery alert or prompt example with ok or cancel choices
I have a jquery script that gives the user a prompt and a choice to make sure they want to delete a value from a datasource. Here is my code... It prompts funny...and it goes ahead and processes anyways even if you select cancel.. Can someone fix me up here? script type=text/javascript $(document).ready(function() { $(a).click(function() { prompt(Are you sure you want to delete?,{buttons: {Ok:true,Cancel:false}}); } ); } ); /script Thanks, Frank
[jQuery] simple browser check (need help)
I have a tool that only operates under IE So all other browser users get an alert here is my code...but it doesn't work... Can someone get me straightened out? script $(document).ready(function() { if($.browser.[safari, opera, mozilla]) { $( function() { alert(You must use Internet Explorer to view the links at this time!); } ); } ); /script
[jQuery] jquery math functions?
Is there a place that I can see the math functions available? Frank
[jQuery] input type text toUpperCase() jquery question
As a user types in content to this this text field I would like tho force the text to uppercase to as keys are pressed. How would this be done? and is toUpperCase a real jquery function? if not wbhat would be a simple way to hndle this with either CSS or someother method... Here is what I have and obviously I am stuck... script type=text/javascript $(document).ready(function() { $('.highball').keypress( function() { $('.highball').toUpperCase() } ); } ); /script input type=text style= class=ac_input highball autocomplete=off id=CityLocal value= type=text Frank
[jQuery] two listboxes(LB) drag names from LB one drop into LB two
Sooting for the moon here, but does anyone have a method for selecting and dragging content from one list box to a second listbox? Frank
[jQuery] easiest question all day
can someone show me an example of creating a simple variable and appending that variable to the document body? Here is my simple example (that doesn't work)... var GitRDone = smoke'n hot; $GitRDone.appendTo('body'); Thanks, Frank
[jQuery] Re: multiple select box to textarea
var s = $('select').serializeArray(), t = []; $.each(s,function(n,v){ t[t.length]=v.value; }); $('textarea').val(t.join('\n')); Hi I understand maybe 40 percent of the above code. Can someone explain it? What does the brackets mean the [] brackets. And can someone tell me what is happening in the $.each(s,function(n,v) what's happening here. also the t[t.length]=v.value; what is happening here. and finally the t.join \n is that adding a carriage return or something? Also, I tried to paste it into a script tag with the document ready stuff set and it didn't work I am running jQuery 1.2. Thasnk Frank On Sep 18, 2:16 am, Wizzud [EMAIL PROTECTED] wrote: This will put all selects (just selected values, no names) into textarea... var s = $('select').serializeArray(), t = []; $.each(s,function(n,v){ t[t.length]=v.value; }); $('textarea').val(t.join('\n')); FrankTudor wrote: Hi all, I am creating a little tool that has two multiple select boxes and then a text area. I need to figure out how to take the selected conets of one box, or the other, or both and pop them to the textarea. If there are no examples can someone tell me what dom or events I need to be looking at? -- View this message in context:http://www.nabble.com/multiple-select-box-to-textarea-tf4469504s15494... Sent from the JQuery mailing list archive at Nabble.com.
[jQuery] multiple select box to textarea
Hi all, I am creating a little tool that has two multiple select boxes and then a text area. I need to figure out how to take the selected conets of one box, or the other, or both and pop them to the textarea. If there are no examples can someone tell me what dom or events I need to be looking at?
[jQuery] Simple append?
Hi all, I am very new to jQuery, but I need to construct a simple was to bold everything inside a td that looks like this td align=right I got the shell in place and the script is being pulled successfully I just need to figure out how to append this condition. Thanks, Frank
[jQuery] slidetoggle with repeating section
Hi guys I have something that I am not sure how to figure out. I have some jquery code that auto hides a section of text. then a hyperlink to toggle showing or hiding the text. Here is an example: script type=text/javascript $(document).ready(function(){ $('.comments').hide(); $('.attachments').hide(); $(.buttonslidedown).click(function() { $(.comments).slideToggle(normal); }); $(.buttonslidedown2).click(function() { $(.attachments).slideToggle(normal); }); }); /script a href=# class=buttonslidedownView/Hide Comments/a : a href=# class=buttonslidedown2View/Hide Attachemnts/a div class=comments pComments brbr Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras sit amet sapien eu nisi malesuada tincidunt. Aliquam erat volutpat. Mauris non dolor. Sed metus lacus, volutpat eget, euismod ut, blandit sit amet, quam. Phasellus feugiat mattis dolor. Praesent tincidunt nisl sed neque. Curabitur fringilla, enim ac vehicula lobortis, elit purus pharetra odio, vitae suscipit quam dui id pede. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis fermentum, metus eu facilisis sodales, elit velit euismod ante, vel faucibus neque purus et turpis. Praesent metus. Sed id orci. Vestibulum sodales felis nec neque. Duis dolor. /p /div div class=attachments pAttachments brbr a href=#Filenet Document Or Link/abr a href=#Filenet Document Or Link/abr a href=#Filenet Document Or Link/abr /div The problem is that I am going to make this dynamic so that code above repates for as many records is in a database. On my current screen i have three of these groups and you probably have guessed if I click on one link (because the class is shared) all divs open and close witht he toggle. How can I get around this? Thanks Frank
[jQuery] Re: Simple append?
Ok thanks I will give this a try :) On Sep 13, 11:46 am, Alexandre Plennevaux [EMAIL PROTECTED] wrote: In fact this should be more radical, but more resource heavy: : $(td[align='right'] *).css({fontWeight: bold}); -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alexandre Plennevaux Sent: jeudi 13 septembre 2007 16:37 To: jquery-en@googlegroups.com Subject: [jQuery] Re: Simple append? Try this: $(td[align='right']).css({fontWeight: bold}); -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of FrankTudor Sent: jeudi 13 septembre 2007 15:10 To: jQuery (English) Subject: [jQuery] Simple append? Hi all, I am very new to jQuery, but I need to construct a simple was to bold everything inside a td that looks like this td align=right I got the shell in place and the script is being pulled successfully I just need to figure out how to append this condition. Thanks, Frank Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.485 / Base de données virus: 269.13.16/1004 - Date: 12/09/2007 17:22 Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.485 / Base de données virus: 269.13.16/1004 - Date: 12/09/2007 17:22
[jQuery] onclick page goes to top (have to scroll back down to content)
Hi have a page that has some javascript events basically I have the accordian effects in a page with repating data...It is fin until I get close to the bottom of the screen and expand the page. Next thing I know I am back up towards the top of the page and have to scroll down to read the text. I know there is a way to hold the page's position, but what function(s) would I be looking at?
[jQuery] Re: onclick page goes to top (have to scroll back down to content)
I'm in a secure environment, but you are right about the # in the url I put the hash marks in for testing. Will this change when actual data is provided? Pr should I leave the a href blank, since all I am using it for is to expand the div that holds the hidden data. Here is some sample code: script type=text/javascript src=js/jquery.js/script script type=text/javascript $(document).ready(function(){ $('div.tryIt:eq(0) div').hide(); $('.tryIt:eq(0) a').click(function() { $(this).next().slideToggle('slow'); }); }); /script div class=tryIt hr h4a href=approvalDetails.cfmApproval Request 562 | Submitted By: Doug Beck | Date Submitted: 9/14/07/a/h4 a href=#View/Hide Comments/a div p align=left Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras sit amet sapien eu nisi malesuada tincidunt. Aliquam erat volutpat. Mauris non dolor. Sed metus lacus, volutpat eget, euismod ut, blandit sit amet, quam. Phasellus feugiat mattis dolor. Praesent tincidunt nisl sed neque. Curabitur fringilla, enim ac vehicula lobortis, elit purus pharetra odio, vitae suscipit quam dui id pede. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis fermentum, metus eu facilisis sodales, elit velit euismod ante, vel faucibus neque purus et turpis. Praesent metus. Sed id orci. Vestibulum sodales felis nec neque. Duis dolor. /div /p a href=#View/Hide Attachments/a div p align=left a href=#Filenet Document Or Link/abr a href=#Filenet Document Or Link/abr a href=#Filenet Document Or Link/abr /div /div On Sep 13, 2:44 pm, Theodore Ni [EMAIL PROTECTED] wrote: Often this occurs when the onclick event for a link does not return false, and then the browser loads the href, often # which moves the page to the top. Is there a test page you can show us where this is happening for you? On 9/13/07, FrankTudor [EMAIL PROTECTED] wrote: Hi have a page that has some javascript events basically I have the accordian effects in a page with repating data...It is fin until I get close to the bottom of the screen and expand the page. Next thing I know I am back up towards the top of the page and have to scroll down to read the text. I know there is a way to hold the page's position, but what function(s) would I be looking at? -- Ted
[jQuery] Question about Collapse/Expand
Hi there is an example that I would like to use on a friends website. Here is the link: http://docs.jquery.com/Tutorials:Live_Examples_of_jQuery I am working with example b. The think I am trying to do is to make it default collapesed instead of expanded. How would I do this? Thanks, Frank