[jQuery] Refactoring javascript
Anyone know of any software or web app that can help with refactoring javascript?
[jQuery] JSON: Cascading Dropdowns?
Does anyone have an example of a two step Cascading Dropdown working from a single JSON object? Here's an example of my JSON. Product Size > Product Width "productlist":[{ "size":"XL", "details":[ { "id":"1", "width":"40", "quantityleft":"4" }, { "id":"2", "width":"24", "quantityleft":"6" }, { "id":"3", "width":"22", "quantityleft":"1" }, "size":"S", "details":[ { "id":"11", "width":"40", "quantityleft":"4" }, { "id":"12", "width":"24", "quantityleft":"6" }, { "id":"13", "width":"22", "quantityleft":"1" } ] }]
[jQuery] Architect This: Cascading dropdowns :)
I have 2 dropdown lists (car and color). when I choose my car, I want my distinct list of colors. After i select both, I want to display how many are in stock. I thought about pushing down to the client a string array/JSON object something like this when the page loads ({Civic:Blue:3},{Civic:Red:2}, etc...) Ideas on implementation? Thanks everyone! paul
[jQuery] Nested Fieldsets
So I have a nested fieldset group 4 levels deep (potentially). I'd like to be able to click on the legend to expand and collapse the fieldsets within. I don't want to hide the fieldsets, just reduce the height so that the contents within are not seen until they click on the legend. ideas?
[jQuery] Displaying more information without shifting the page
My issue is this. I have a box that has a fixed height with repeatable elements in it. I want to display the top eight with a "More" link/button. When the user clicks "More", the box essentially floats on top of its designated area and expands OVER the top of everything else. (much like a drop down list would float over the top of items). Ideas? Plugins?
[jQuery] Re: traversing UL: Request for help
thanks @mkmanning... it works perfectly. On Apr 24, 12:35 am, mkmanning wrote: > From the sample markup with the highlight classes, it looks like the > OP wants to highlight anchors in the LI tags that are in direct line > to the final anchor. In that case, just adding the class to all the > anchors in each parent UL won't work. If you filter the results you > can achieve what your sample code indicates: > > $('a').hover(function(){ > var _this = this; > $(this).parents('li').find('a').filter(function(){ > return $.inArray(_this,$(this).parent().find('a'))+1; > }).addClass('highlight');},function(){ > > $(this).parents('li').find('a').removeClass('highlight'); > > }); > > On Apr 23, 2:51 pm, Ricardo wrote: > > > > > Assuming the base UL or any of it's parents are contained in another > > UL (which would mess this up): > > > $(this).parents('ul').find('a').addClass('highlight'); > > > On Apr 23, 5:00 pm, paulinstl wrote: > > > > Request: I want to highlight every "" within the parents of an > > > object up to the base element of "" > > > > For example, this original code: > > > > > > link > > > link > > > > > > link > > > link > > > > > > link > > > > > > HOVER OVER THIS > > > > > > > > > link > > > > > > > > > link > > > > > > > > > link > > > > > > > Should appear like so (assuming an addclass method): > > > > > > > link > > > link > > > > > > link > > > link > > > > > > link > > > > > > HOVER OVER THIS > > li> > > > > > > > > > link > > > > > > > > > link > > > > > > > > > link > > > > > > > I'm at a loss and I'm tired. Can you help a brother out? Basically > > > the best path from A to Z > > > > Thanks for glancing at this. > > > > paul- Hide quoted text - > > - Show quoted text -
[jQuery] Re: traversing UL: Request for help
This looks promising. I'll give it a shot and report back. On Apr 24, 12:35 am, mkmanning wrote: > From the sample markup with the highlight classes, it looks like the > OP wants to highlight anchors in the LI tags that are in direct line > to the final anchor. In that case, just adding the class to all the > anchors in each parent UL won't work. If you filter the results you > can achieve what your sample code indicates: > > $('a').hover(function(){ > var _this = this; > $(this).parents('li').find('a').filter(function(){ > return $.inArray(_this,$(this).parent().find('a'))+1; > }).addClass('highlight');},function(){ > > $(this).parents('li').find('a').removeClass('highlight'); > > }); > > On Apr 23, 2:51 pm, Ricardo wrote: > > > > > Assuming the base UL or any of it's parents are contained in another > > UL (which would mess this up): > > > $(this).parents('ul').find('a').addClass('highlight'); > > > On Apr 23, 5:00 pm, paulinstl wrote: > > > > Request: I want to highlight every "" within the parents of an > > > object up to the base element of "" > > > > For example, this original code: > > > > > > link > > > link > > > > > > link > > > link > > > > > > link > > > > > > HOVER OVER THIS > > > > > > > > > link > > > > > > > > > link > > > > > > > > > link > > > > > > > Should appear like so (assuming an addclass method): > > > > > > > link > > > link > > > > > > link > > > link > > > > > > link > > > > > > HOVER OVER THIS > > li> > > > > > > > > > link > > > > > > > > > link > > > > > > > > > link > > > > > > > I'm at a loss and I'm tired. Can you help a brother out? Basically > > > the best path from A to Z > > > > Thanks for glancing at this. > > > > paul- Hide quoted text - > > - Show quoted text -
[jQuery] traversing UL: Request for help
Request: I want to highlight every "" within the parents of an object up to the base element of "" For example, this original code: link link link link link HOVER OVER THIS link link link Should appear like so (assuming an addclass method): link link link link link HOVER OVER THIS link link link I'm at a loss and I'm tired. Can you help a brother out? Basically the best path from A to Z Thanks for glancing at this. paul
[jQuery] Re: Modifying jQuery to decrease file size.
I'm very happy with jQuery, i just don't need all of it. Kinda like how the jqueryUI builds custom downloads. On Apr 22, 11:08 am, jerone wrote: > I would never recommand removing parts from a library. > jQuery is one of the smallest libraries, but I you want it smaller, > you better script it yourself.
[jQuery] Re: Modifying jQuery to decrease file size.
bump. On Apr 20, 4:19 pm, paulinstl wrote: > I'm currently using about one third of the jQuery library and I'm > wondering if I can safely remove unused functions that are not being > internally called nor called by my code in an effort to reduce > filesize further. > > I realize that minified and gzipped its already small, but when there > may be millions of downloads a day...i need it small. :) > > thoughts? > > regards, > paul
[jQuery] Modifying jQuery to decrease file size.
I'm currently using about one third of the jQuery library and I'm wondering if I can safely remove unused functions that are not being internally called nor called by my code in an effort to reduce filesize further. I realize that minified and gzipped its already small, but when there may be millions of downloads a day...i need it small. :) thoughts? regards, paul
[jQuery] Re: Intellisense woes.
Thanks for taking a look, Stephen. Any ideas on annotating a jquery UI vsdoc file? Anyway... i'm back to coding. On Feb 9, 4:21 pm, MorningZ wrote: > I'm aware of the different ways to call .ready(), i was simply > pointing out a few things > > 1) The problems you are having do not mean that jQuery + Studio + > Intellisense doesn't work > > 2) That in two your examples that you work fine here, and I pointed > out that I had to make Studio skip over other jQuery files that were > causing Intellisense to stop working and this is well documented: > > http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense... > > http://blogs.msdn.com/webdevtools/archive/2008/11/18/jscript-intellis... > (specifically #6 through #8) > > That's my help i can/will provide, best of luck if you choose to > follow it.. Intellisense definitely makes life easier :-) > > On Feb 9, 5:10 pm, paulinstl wrote: > > > > > There are different ways to call document.ready in jquery. Here's > > what does and does not work > > > These all do the same thing... > > > > > jQuery(function($) {//FAILS WITH INTELLISENSE THOUGH JQUERY CALLS > > THIS FAILSAFE > > $("div").FAIL > > } > > > jQuery(function() { //WORKS WITH INTELLISENSE > > $("div").ajaxError; > > } > > > $(function(){//WORKS WITH INTELLISENSE > > $("div").ajaxComplete; > > } > > > > > > On Feb 9, 4:03 pm, MorningZ wrote: > > > > jQuery() > > > > works just fine for me > > > >http://i42.tinypic.com/34y65xv.jpg > > > > On Feb 9, 4:58 pm, paulinstl wrote: > > > > > Apparently when I start my document ready as jQuery(function($){}) it > > > > fails. When I use $(function{}), it's fine. > > > > > ergh. > > > > > On Feb 9, 3:19 pm, paulinstl wrote: > > > > > > So I have the new 1.3.1 and vsdoc js file. > > > > > > I can get intellisense up to the point of "$(" > > > > > After I complete that I get nothing after the "." > > > > > > ex ( $(".selector"). ) > > > > > > I get no chaining, nothing. I have all the patches installed for > > > > > VS2008 sp1 > > > > > > So what's the formula for getting this plane of the ground?- Hide > > > > > quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text -
[jQuery] Re: Intellisense woes.
There are different ways to call document.ready in jquery. Here's what does and does not work These all do the same thing... jQuery(function($) {//FAILS WITH INTELLISENSE THOUGH JQUERY CALLS THIS FAILSAFE $("div").FAIL } jQuery(function() { //WORKS WITH INTELLISENSE $("div").ajaxError; } $(function(){//WORKS WITH INTELLISENSE $("div").ajaxComplete; } On Feb 9, 4:03 pm, MorningZ wrote: > jQuery() > > works just fine for me > > http://i42.tinypic.com/34y65xv.jpg > > On Feb 9, 4:58 pm, paulinstl wrote: > > > > > Apparently when I start my document ready as jQuery(function($){}) it > > fails. When I use $(function{}), it's fine. > > > ergh. > > > On Feb 9, 3:19 pm, paulinstl wrote: > > > > So I have the new 1.3.1 and vsdoc js file. > > > > I can get intellisense up to the point of "$(" > > > After I complete that I get nothing after the "." > > > > ex ( $(".selector"). ) > > > > I get no chaining, nothing. I have all the patches installed for > > > VS2008 sp1 > > > > So what's the formula for getting this plane of the ground?- Hide quoted > > > text - > > - Show quoted text -
[jQuery] Re: Intellisense woes.
Here's the detail from jquery ... Definition: Uses both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias. jQuery(function($) { // Your code using failsafe $ alias here... }); Yeah, that above "failsafe" code is crap with intellisense. On Feb 9, 3:58 pm, paulinstl wrote: > Apparently when I start my document ready as jQuery(function($){}) it > fails. When I use $(function{}), it's fine. > > ergh. > > On Feb 9, 3:19 pm, paulinstl wrote: > > > > > So I have the new 1.3.1 and vsdoc js file. > > > I can get intellisense up to the point of "$(" > > After I complete that I get nothing after the "." > > > ex ( $(".selector"). ) > > > I get no chaining, nothing. I have all the patches installed for > > VS2008 sp1 > > > So what's the formula for getting this plane of the ground?- Hide quoted > > text - > > - Show quoted text -
[jQuery] Re: Intellisense woes.
Apparently when I start my document ready as jQuery(function($){}) it fails. When I use $(function{}), it's fine. ergh. On Feb 9, 3:19 pm, paulinstl wrote: > So I have the new 1.3.1 and vsdoc js file. > > I can get intellisense up to the point of "$(" > After I complete that I get nothing after the "." > > ex ( $(".selector"). ) > > I get no chaining, nothing. I have all the patches installed for > VS2008 sp1 > > So what's the formula for getting this plane of the ground?
[jQuery] Intellisense woes.
So I have the new 1.3.1 and vsdoc js file. I can get intellisense up to the point of "$(" After I complete that I get nothing after the "." ex ( $(".selector"). ) I get no chaining, nothing. I have all the patches installed for VS2008 sp1 So what's the formula for getting this plane of the ground?
[jQuery] Re: dynamically building the "for" attribute
Thanks Mauricio, I know that :checkbox will work, jQuery documentation states that using input:checkbox is more readable and actually performs better. But yes, your code worked well! On Feb 5, 11:02 am, "Mauricio \(Maujor\) Samy Silva" wrote: > Hi Paul, > > $(':checkbox') matches all inputs elements whose type is checkbox. > Inputs are implied in this selector, so you don't need modify it. :) > > Maurício > > -Mensagem Original- > De: "paulinstl" > Para: "jQuery (English)" > Enviada em: quinta-feira, 5 de fevereiro de 2009 14:28 > Assunto: [jQuery] Re: dynamically building the "for" attribute > > Mauricio, > > This was exactly what I needed... I modified it a bit (:checkbox to > input:checkbox) and closed out the function. > > $('#searchresults > div > label').each(function() { var checkboxId = $ > (this).prev('input:checkbox').attr('id'); $(this).attr('for', > checkboxId) }); > > On Feb 5, 8:52 am, "Mauricio \(Maujor\) Samy Silva" > > > > wrote: > > $('#my-form label').each(function() { > > var checkboxId = $(this).prev(':checkbox').attr('id') > > $(this).attr('for', checkboxId) > > > Maurício > > > -Mensagem Original- > > De: "paulinstl" > > Para: "jQuery (English)" > > Enviada em: quinta-feira, 5 de fevereiro de 2009 12:25 > > Assunto: [jQuery] dynamically building the "for" attribute > > > > I have a series of labels and checkboxes. > > > > The checkboxes' IDs are generated on the fly, so I have no way of > > > knowing the id at the server (without a lot of heavy lifting). > > > > I'd like to do this in jquery... > > > > here's what I have so far > > > > HTML > > > something > > label> > > > something > > label> > > > something > > label> > > > something > > label> > > > > jquery > > > > $("label").attr("for", $ > > > (this).somethingToGoHereToSetTheIdOfThePrevElement.text > > > () ); > > > > I'm missing the way to traverse this- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text -
[jQuery] Re: dynamically building the "for" attribute
Mauricio, This was exactly what I needed... I modified it a bit (:checkbox to input:checkbox) and closed out the function. $('#searchresults > div > label').each(function() { var checkboxId = $ (this).prev('input:checkbox').attr('id'); $(this).attr('for', checkboxId) }); On Feb 5, 8:52 am, "Mauricio \(Maujor\) Samy Silva" wrote: > $('#my-form label').each(function() { > var checkboxId = $(this).prev(':checkbox').attr('id') > $(this).attr('for', checkboxId) > > Maurício > > -Mensagem Original- > De: "paulinstl" > Para: "jQuery (English)" > Enviada em: quinta-feira, 5 de fevereiro de 2009 12:25 > Assunto: [jQuery] dynamically building the "for" attribute > > > > > > > I have a series of labels and checkboxes. > > > The checkboxes' IDs are generated on the fly, so I have no way of > > knowing the id at the server (without a lot of heavy lifting). > > > I'd like to do this in jquery... > > > here's what I have so far > > > HTML > > something > label> > > something > label> > > something > label> > > something > label> > > > jquery > > > $("label").attr("for", $ > > (this).somethingToGoHereToSetTheIdOfThePrevElement.text > > () ); > > > I'm missing the way to traverse this- Hide quoted text - > > - Show quoted text -
[jQuery] dynamically building the "for" attribute
I have a series of labels and checkboxes. The checkboxes' IDs are generated on the fly, so I have no way of knowing the id at the server (without a lot of heavy lifting). I'd like to do this in jquery... here's what I have so far HTML something something something something jquery $("label").attr("for", $ (this).somethingToGoHereToSetTheIdOfThePrevElement.text () ); I'm missing the way to traverse this
[jQuery] Re: find text within the page
yeah.. this finds it by classname (.keyword) , I need to be able to traverse all elements On Feb 3, 9:39 am, Eric Garside wrote: > Try: > $(function(){ > var keywords = [ ... ]; > $.each(keywords, function(){ > var kw = this, rx = new RegExp('/^ '+kw+' $/'); > $(".keyword:contains('"+kw+"')") .each(function(){ > $(this).text($(this).text().replace(rx, ''+kw+' span>')); > }); > }); > > }); > > It's untested, but I think that should work? The Regex is adding > whitespace to either side of the keyword intentionally, to only catch > full words (so " the RED fox" gets matched but " was near a REDwood > tree." does not. Though, I'm not a regexpert, so I'm not positive what > I've given you is the right way to go there, but hopefully it gives > you a base to work from. > > On Feb 3, 10:20 am, paulinstl wrote: > > > > > Rob, > > > My problem is that I have no way of knowing where the keyword may > > appear. It might be tabular data () or in descriptive paragraph > > (). > > > So if my keyword is RED, then... > > > BEFORE > > the red fox > > > AFTER > > the red fox > > > I'll have an array of keywords as well. var arrayx["one", "two" > > "three"] > > > On Feb 2, 5:57 pm, RobG wrote: > > > > On Feb 3, 8:01 am, paulinstl wrote: > > > > > I'm looking for a way to locate keywords to help the end user out. > > > > > For instance, if I want to find the word "polar" then i'd like my > > > > function to locate it, wrap it with a span, and assign it a function. > > > > > so far I can locate using a content filter and classname like this... > > > > > $(".keyword:contains('polar')") > > > > > But this selects the whole element (paragraph, div, whatever) > > > > > how do i focus in on JUST the text? > > > > The most reliable method is to traverse the part of the DOM you want > > > to search and look at the value of text nodes. If you want to > > > highlight a particular character pattern, use a regular expression and > > > DOM methods to wrap it in a suitable element, say a span. It would > > > also be prudent to also put adjacent text in spans too, e.g. > > > > Lorem ipsum dolor sit amet, consectetur adipiscing elit. > > > > might become: > > > > Lorem ipsum dolor > > > sit amet, consectetur adipiscing elit. > > > > That way you can also deal with text found inside elements like B or > > > QUOTE if necessary. > > > > Other approaches such as using a regular exprssion and an element's > > > innerHTML property, are likely to be error prone. > > > > -- > > > Rob- Hide quoted text - > > - Show quoted text -
[jQuery] Re: find text within the page
Rob, My problem is that I have no way of knowing where the keyword may appear. It might be tabular data () or in descriptive paragraph (). So if my keyword is RED, then... BEFORE the red fox AFTER the red fox I'll have an array of keywords as well. var arrayx["one", "two" "three"] On Feb 2, 5:57 pm, RobG wrote: > On Feb 3, 8:01 am, paulinstl wrote: > > > I'm looking for a way to locate keywords to help the end user out. > > > For instance, if I want to find the word "polar" then i'd like my > > function to locate it, wrap it with a span, and assign it a function. > > > so far I can locate using a content filter and classname like this... > > > $(".keyword:contains('polar')") > > > But this selects the whole element (paragraph, div, whatever) > > > how do i focus in on JUST the text? > > The most reliable method is to traverse the part of the DOM you want > to search and look at the value of text nodes. If you want to > highlight a particular character pattern, use a regular expression and > DOM methods to wrap it in a suitable element, say a span. It would > also be prudent to also put adjacent text in spans too, e.g. > > Lorem ipsum dolor sit amet, consectetur adipiscing elit. > > might become: > > Lorem ipsum dolor > sit amet, consectetur adipiscing elit. > > That way you can also deal with text found inside elements like B or > QUOTE if necessary. > > Other approaches such as using a regular exprssion and an element's > innerHTML property, are likely to be error prone. > > -- > Rob
[jQuery] find text within the page
I'm looking for a way to locate keywords to help the end user out. For instance, if I want to find the word "polar" then i'd like my function to locate it, wrap it with a span, and assign it a function. so far I can locate using a content filter and classname like this... $(".keyword:contains('polar')") But this selects the whole element (paragraph, div, whatever) how do i focus in on JUST the text?