[jQuery] Re: Question related to Javascript
If you are using Prototype and jQuery you will need to do: var $j =jQuery.noConflict(); otherwise the will be a conflict for the $. Then, when you wan't to do things in jQuery, do $j and when you want to do things in Prototype, do $. Is $(imgDisplay0).src = imgs0Slideshow[start].image; correct? I believe this is correct for Prototype, and means the source of the image with an id of imgDisplay0 is set to imgs0Slideshow[start].image In jQuery, the same line is: $('#imgDisplay0').attr('src', imgs0Slideshow[start].image); With jQuery, you cannot access any of the DOM element attributes or methods directly because they are stored in a jQuery collection that is returned. Look at the jQuery documentation on the jQuery site, it is quite extensive and will show you what you need. If you need help with Prototype code though, you should try the Prototype google group instead. On Feb 8, 11:52 pm, MH1988 m.lawrencehu...@gmail.com wrote: Would be great if someone could still help me out? On Feb 8, 10:01 pm, MH1988 m.lawrencehu...@gmail.com wrote: Sorry, just also to mention, I am integrating this within WordPress and I am using the jQuery framework for another gallery. On Feb 8, 9:58 pm, MH1988 m.lawrencehu...@gmail.com wrote: Thanks so much for the help. I'm afraid it still isn't working correctly. I tried [0] which to me means it initiates the very first image as soon as it preloads. For more details of how I am using this, I am actually using the Prototype script framework which makes this image gallery work. Is $(imgDisplay0).src = imgs0Slideshow[start].image; correct? I'm wondering if there is still something missing to make it work? Also, it would also be great if you could explain some of the things mentioned more simpler as I'm inexperienced. Many thanks. On Feb 8, 8:11 pm, seasoup seas...@gmail.com wrote: Also, instead of saying var imgs0Slideshow = new Array(); imgs0Slideshow[0] = new Object(); It's easier to just say var imgs0Slideshow = []; imgs0Slideshow[0] = {}; and that achieves the exact same thing. On Feb 8, 1:10 am, seasoup seas...@gmail.com wrote: $(imgDisplay0_title).innerHTML = title; $(imgDisplay0_caption).innerHTML = caption; $(imgDisplay0_number).innerHTML = 1 of + imgs0Slideshow.length + Articles; should be $(imgDisplay0_title).html(title); $(imgDisplay0_caption).html(caption); $(imgDisplay0_number).html('1 of ' + imgs0Slideshow.length + ' Articles'); or $(imgDisplay0_title).text(title); $(imgDisplay0_caption).text(caption); $(imgDisplay0_number).text('1 of ' + imgs0Slideshow.length + ' Articles'); or $(imgDisplay0_title).get(0).innerHTML = title; $(imgDisplay0_caption).get(0).innerHTML = caption; $(imgDisplay0_number).get(0).innerHTML = 1 of + imgs0Slideshow.length + Articles; or $(imgDisplay0_title)[0].innerHTML = title; $(imgDisplay0_caption)[0].innerHTML = caption; $(imgDisplay0_number)[0].innerHTML = 1 of + imgs0Slideshow.length + Articles; .html('text'); is the standard jQuery way to do add html, but is slower then .text which is the jQuery way to add plain text, which is slower then .innerHTML, but not by significant amounts unless you are in a big loop. .html() also handles removing events from DOM Elements that are written over this way which prevents circular references that can cause memory leaks. but, if speed is a big factor and you don't have any events doing .get(0) or [0] work. The problem is that $() returns a jQuery collection not a DOM object with the .innerHTML method. .get(0) or [0] will return the first element in the jQuery collection which is the DOM node you are looking for with the innerHTML method. Hope that helps. Josh Powell On Feb 7, 10:10 pm, MH1988 m.lawrencehu...@gmail.com wrote: I hope I am able to still receive assistance even though this isn't jQuery 100% and what I have is an image gallery I am using. The only thing I need to work out is how to make sure the initial title and captions appear when you load the webpage? script type='text/javascript' var imgs0Slideshow = new Array(); var imgs0; imgs0Slideshow[0] = new Object(); imgs0Slideshow[0].image = ; imgs0Slideshow[0].title = ; imgs0Slideshow[0].caption = shshshshshsh; imgs0Slideshow[1] = new Object(); imgs0Slideshow[1].image = ; imgs0Slideshow[1].title = Array; imgs0Slideshow[1].caption = shshshshs; imgs0Slideshow[2] = new Object(); imgs0Slideshow[2].image = ; imgs0Slideshow[2].title = ; imgs0Slideshow[2].caption = shshshsh; var start = 0; imgs0 = new MudFadeGallery('imgs0', 'imgDisplay0', imgs0Slideshow, {startNum: start, preload: true, autoplay: 4});
[jQuery] Re: Does it hurt to call functions that don't do anything on the page?
I not sure if this suits you, but you could split your functions to separate files and then lazy load each js file as necessary. In such case http://nicolas.rudas.info/jQuery/getPlugin/ may be helpful Otherwise I find Ricardo's suggestion the easiest. You could also do some time tests to check whether calling these functions when not really needed effects performance, and act accordingly On Feb 9, 3:33 am, mkmanning michaell...@gmail.com wrote: *Tab+spacebar and it posts :P You could put your list of functions in an array in your external js, then call them on the window object in a loop: $(function() { var funcs = [ 'ManageCategoriesClick', 'HideByDefault', 'PrepareSplitForm', 'SetUpAdvertPopup', 'CheckAll', 'CheckNone', 'EditCategoryInPlace', 'PreparePaneLinks', 'PrepareToolTips' ] $.each(funcs,function(i,f){ if(typeof(window[f]) == 'function'){ window[f](); } }); }); On Feb 8, 5:21 am, Beau zar...@gmail.com wrote: Thanks for the ideas everyone! @Stephan: Yes, it's in an external JS file. I'd prefer to not have to do any inline javascript. I've considered it, but thanks for the suggestion! @Ricardo: Thanks for those. I may end up doing a variation of them. On Feb 8, 4:50 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi I guess you have your $().ready() function in an external js file, otherwise you could customize it for the according html page. Another construct similar to Ricardos one, but a bit more flexible: Use a global variable in every html file to specify the init functions you want to call for this page: script type=text/javascript myInitFxn = [ManageCategoriesClick, HideByDefault, PrepareSplitForm,...]; /script ready.js: $().ready(function(){ for(var i in myInitFxn) { myInitFxn[i](); // call init function } }); by(e) Stephan 2009/2/8 brian bally.z...@gmail.com: On Sat, Feb 7, 2009 at 11:21 PM, Ricardo Tomasi ricardob...@gmail.com wrote: Alternatively you could add a different class to the body of each page, then use this rather amusing construct: $(document).ready((function(){ var is = function(v){ return ++document.body.className.indexOf(v) }; return( is('categories') ? ManageCategoriesClick : is('hidebydefault') ? HideByDefault : is('form') ? PrepareSplitForm : is('advert') ? SetUpAdvertPopup : function(){} //nothing ); })()); That is, indeed, amusing. And one for my toy chest. Thanks! Who knew, back in '96, that javascript was going to turn out to be so much fun?
[jQuery] Re: Disable a link temporarily
Thank you for the replies. I like the toggle idea. It's simple and it works. Cheers, Rob. On Feb 7, 11:35 am, donb falconwatc...@comcast.net wrote: Rather than bindin/unbinding events, why not put a hidden label (or tag of your choice) there with the same text, then toggle between them: $(a, label).toggle(); Show the anchor or show the label. On Feb 7, 6:07 am, jQuery Lover ilovejqu...@gmail.com wrote: $('a.show_reset_pass_box').unbind('click'); This line is unbinding ALL click events. So the second click binding function is not fired, since it's not bound... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:48 PM,rob303rob.cub...@googlemail.com wrote: Hi, This should be easy. I want to disable a link and then re-enable it later. I have: $('a.show_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').unbind('click'); return false; }); Which works just fine. But then when I try to do: $('a.close_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').bind('click'); return false; }); The click event isn't bound back onto the anchor. The anchor looks like this: a class=show_reset_pass_box title=Lost Password?Lost Password?/ a What am I doing wrong? Many thanks in advance for any hekp. Rob.
[jQuery] Re: Using jQuery Validation with Dot Net
@ RobG: #aspnetForm is the form that wraps the whole of a dot net page. I simply posted the html snippet from the form itself. Individual forms do not have their own form tags, there is one large one that encloses the whole page - part of the dot net infrastructure. @ Aaron Grundel: No, but i will put one up tonight if it will help. I'm eager to use this validation plugin! On Feb 9, 2:14 am, RobG rg...@iinet.net.au wrote: On Feb 9, 8:30 am, Jon cakeordeat...@gmail.com wrote: I'm having issues getting the validation plugin (http://bassistance.de/ jquery-plugins/jquery-plugin-validation/) to work with dot net. Whatever i try i can't stop the form from submitting. I've tried several things i've found on this group and the web. Can anyone help me getting this to work? Here's my html. span id=ctl00_Control_LeftColumn_CF_Contact class=ContactForm p class=SuccessMessageSubmitted/p span class=Field span class=LabelName /span span class=Validation span id=ctl00_Control_LeftColumn_CF_Contact_ctl01_ctl04 style=display: none;/ /span input id=ctl00_Control_LeftColumn_CF_Contact_ctl01_TB_TextBox class=TextBox Name type=text name=ctl00$Control_LeftColumn $CF_Contact$ctl01$TB_TextBox/ /span span class=Field /span span class=Field /span a id=ctl00_Control_LeftColumn_CF_Contact_LB_Submit class=Submit href=javascript:__doPostBack('ctl00$Control_LeftColumn$CF_Contact $LB_Submit','') style=background-color: rgb(51, 51, 51);Submit/a /span Invalid markup, there is no form. And here is my javascript: $(document).ready(function(){ $(#aspnetForm).validate({ Where is #aspnetForm? -- Rob
[jQuery] what could be causing this isnull error ( realy weird )
Hi http://www.howardsplaza.nl If you go to this page in firebug you see an isnull error. the same goes if you click the test click link. Why does this generate the isnull error. The fist one is indeed only on page after user is logged in but that should not be an issue . But the text click link tries to hide a few div with classes that are actually one the page any help would be appreciated since it appears i must be overlooking somthing
[jQuery] Re: test for css selector capability?
Hi Geuis, Ther is a function with alias ($.browser) it will gives u functionality to identify browser name like this *$.browser.mozilla , $.browser.msie , ** $.browser.opera , $.browser.safari.* if u wana return the version of browser , then u have use below function *$.browser.version *it will return version of current browser according to ur problem ie6 u can add css on the fly. hope this will work . cheers cioa On Mon, Feb 9, 2009 at 11:47 AM, Geuis geuis.te...@gmail.com wrote: I'm working on a project where I need to detect if the browser natively supports a given CSS selector. For example, if I am using the selector 'ul li:first-child', this is supported by IE7, FF, and Safari but not by IE6 and below. Is there a way that I can test that selector to see if the current browser supports it? A feature that returns a simple boolean status would be awesome. -- ---| Regard |--- Mohd.Tareque
[jQuery] Jquery Grid not displaying data read from XML in IE 6.0
Hi, I am displaying a Grid in Jquery reading data from a XML file.It is displayed correctly in FireFox, Chrome but data is not displayed in IE 6.0. My code is : !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http:// www.w3.org/TR/html4/loose.dtd html head link rel=stylesheet href=./themes/sand/grid.css / link rel=stylesheet href=./themes/jqModal.css / script type=text/javascript src=jquery-1.2.6.js/script script type=text/javascript src=jquery.jqGrid.js/script script type=text/javascript src=./js/jqModal.js/script script type=text/javascript src=./js/jqDnR.js/script script type=text/javascript // Your code goes here jQuery(document).ready(function () { jQuery(#list19).jqGrid({ url: 'books.xml', datatype: xml, mtype: 'GET', colNames:[Author,Title, Price, Published Date], colModel:[ {name:Author,index:Author, width:120, xmlmap:ItemAttributesAuthor}, {name:Title,index:Title, width: 180,xmlmap:ItemAttributesTitle}, {name:Price,index:Manufacturer, width:100, align:right,xmlmap:ItemAttributesPrice, sorttype:float}, {name:DatePub,index:ProductGroup, width: 130,xmlmap:ItemAttributesDatePub,sorttype:date} ], height:250, rowNum:10, rowList:[10,20,30], imgpath: ./themes/sand/images, viewrecords: true, loadonce: true, xmlReader: { root : Items, row: Item, repeatitems: false, id: ASIN }, caption: XML Mapping example }); }); /script /head body table id=list19 class=scroll cellpadding=0 cellspacing=0/ table /body /html
[jQuery] Superfish
Very nice plugin! feature request: delay on mouseout cancellation using the properties onclick() event outside the menu. It is possible?
[jQuery] Not able to View data in Jquery Grid In IE 6.0
I am reading data in Grid using a XML file.The Grid is displayed correctly in Firefox and Chrome but in IE 6.0 the grid is displayed empty. Please help.
[jQuery] handler data overrides event data
Even though jQuery.event.fix copies over the data property from originalEvent, it is overridden by the handler's data property in jQuery.event.handle, even when the handler's data property is not defined. I know of atleast one event which has the data property is used, and that is the message event generated by a postMessage [1]. A workaround is to use the originalEvent's data directly. Since i searched but couldn't find the issue mentioned before, i'm posting it. [1] https://developer.mozilla.org/en/DOM/window.postMessage#The_dispatched_event
[jQuery] [autocomplete]
I just want to thank the person (Jorn Zaefferer?) or people who wrote the autocomplete plugin. I've tried getting other live searches and autocompletes to work with my tiny Javascript knowledge, but it was never clear how everything hung together and I'd lose patience before getting anything done. But the way you bundle the files with a demo makes it easy to hack-and-see. Awesome. Thank you!!!
[jQuery] [validate]
I'm using jquery validate plugin and I have a problem with rules depending of form selectors. In my form I have got two form selectors: select name=client.clientType id=type class=iefixmarginoption value=-- Wybierz --/option option value=BBezrobotny/option option value=NNieaktywny zawodowo/option option value=ZZatrudniony/option option value=IInny/option option value=PPrzedsiebiorstwo/option option value=SSamozatrudnony/option/select and input name=clientnip id=clientnip maxlength=14 value= class=tekst type=text I'd like to make clientnip required if type value is P or S. I tried this: $(#clientnip).rules(add, { required: function(element) { return $(#type).val() == P; return $(#type).val() == S; } It works for type value = P and ignore S. Could some one help me?
[jQuery] Calling ajax function with form submission
Hi, I am fiddling with an form and calling an function which is using the Ajax calls. Below is the code that i am using. script language=javascript type=text/javascript src=jq.js/ script script language=javascript type=text/javascript function submitting() { $.ajax({ type: POST, url: some.php, data: name=Johnlocation=Boston, success: function(msg){ alert( Data Saved: + msg ); } }); return true; } /script form action=myaction.php method=post onsubmit=return submitting () input type=text name=name/br/br/ input type=text name=email/br/br/ input type=submit name=mysub value=Submit /form When i try to submit this form it directly goes to the action file of form that is myaction.php so without finishing the request sent to the some.php from the ajax call. To Resolve this i had put this attribute async: false in the above ajax call. that works however it takes a bit of time before the form starts submitting so this can be annoying for the users. In some.php i am retrieving the data and just sending an email. ALSO i don't wanna use javascript's submit() function. How can i resolve this issue. Please help Thanks !!
[jQuery] Suggestion: datepicker with afterUpdate hook
Hi, I'm thinking that it would be useful to have an afterUpdate hook for datepicker. I've a project that adds some hovering effects to the datepicker cells, and since the datepicker redraws itself after onSelect, all my hovering effects are lost. Adding this afterUpdate hook would allow me to elegantly customize effects on the datepicker cells. Or am i missing something that already exists ? TKS
[jQuery] Re: what could be causing this isnull error ( realy weird )
Hi, May be its not able get the value for ur function ($(.grid_8) ); declare it on top of ur method . See this hope sol this will work regards Ragx On Mon, Feb 9, 2009 at 5:30 PM, Armand Datema nok...@gmail.com wrote: Hi http://www.howardsplaza.nl If you go to this page in firebug you see an isnull error. the same goes if you click the test click link. Why does this generate the isnull error. The fist one is indeed only on page after user is logged in but that should not be an issue . But the text click link tries to hide a few div with classes that are actually one the page any help would be appreciated since it appears i must be overlooking somthing -- ---| Regard |--- Mohd.Tareque
[jQuery] Superfish
Very nice plugin! feature request: delay on mouseout cancellation using the properties onclick() event outside the menu. It is possible?
[jQuery] Re: Calling ajax function with form submission
Hi , If u dont wana use javascript to submit form then remove onSubmit event, If u want to submit it with ajax then remove action attribute add *return false;* regards Ragx On Mon, Feb 9, 2009 at 1:07 PM, Vivek narula.vi...@gmail.com wrote: Hi, I am fiddling with an form and calling an function which is using the Ajax calls. Below is the code that i am using. script language=javascript type=text/javascript src=jq.js/ script script language=javascript type=text/javascript function submitting() { $.ajax({ type: POST, url: some.php, data: name=Johnlocation=Boston, success: function(msg){ alert( Data Saved: + msg ); } }); return true; } /script form action=myaction.php method=post onsubmit=return submitting () input type=text name=name/br/br/ input type=text name=email/br/br/ input type=submit name=mysub value=Submit /form When i try to submit this form it directly goes to the action file of form that is myaction.php so without finishing the request sent to the some.php from the ajax call. To Resolve this i had put this attribute async: false in the above ajax call. that works however it takes a bit of time before the form starts submitting so this can be annoying for the users. In some.php i am retrieving the data and just sending an email. ALSO i don't wanna use javascript's submit() function. How can i resolve this issue. Please help Thanks !!
[jQuery] Re: [validate]
$(#clientnip1).rules(add, { required: function(element) { return $(#type).val() == P; } $(#clientnip2).rules(add, { required: function(element) { return $(#type).val() == S; } one function can return only one value at a time first one i.e. 'p' one to execute 's' one use above two functions . hope this will work ;) regards Ragx On Mon, Feb 9, 2009 at 1:27 PM, koszu rafal.kos...@izbarzem.opole.plwrote: I'm using jquery validate plugin and I have a problem with rules depending of form selectors. In my form I have got two form selectors: select name=client.clientType id=type class=iefixmarginoption value=-- Wybierz --/option option value=BBezrobotny/option option value=NNieaktywny zawodowo/option option value=ZZatrudniony/option option value=IInny/option option value=PPrzedsiebiorstwo/option option value=SSamozatrudnony/option/select and input name=clientnip id=clientnip maxlength=14 value= class=tekst type=text I'd like to make clientnip required if type value is P or S. I tried this: $(#clientnip).rules(add, { required: function(element) { return $(#type).val() == P; return $(#type).val() == S; } It works for type value = P and ignore S. Could some one help me?
[jQuery] Re: what could be causing this isnull error ( realy weird )
HI Well it cant be more simple than this it just tries to get the element with the class .grid-8 which is on the page for sure On Mon, Feb 9, 2009 at 1:06 PM, Mohd.Tareq tareq.m...@gmail.com wrote: Hi, May be its not able get the value for ur function ($(.grid_8) ); declare it on top of ur method . See this hope sol this will work regards Ragx On Mon, Feb 9, 2009 at 5:30 PM, Armand Datema nok...@gmail.com wrote: Hi http://www.howardsplaza.nl If you go to this page in firebug you see an isnull error. the same goes if you click the test click link. Why does this generate the isnull error. The fist one is indeed only on page after user is logged in but that should not be an issue . But the text click link tries to hide a few div with classes that are actually one the page any help would be appreciated since it appears i must be overlooking somthing -- ---| Regard |--- Mohd.Tareque -- Armand Datema CTO SchwingSoft
[jQuery] Re: [validate]
There is just one clientnip, but you can combine the two returns: $(#clientnip).rules(add, { required: function(element) { return $(#type).val() == P || $(#type).val() == S; } Jörn On Mon, Feb 9, 2009 at 1:15 PM, Mohd.Tareq tareq.m...@gmail.com wrote: $(#clientnip1).rules(add, { required: function(element) { return $(#type).val() == P; } $(#clientnip2).rules(add, { required: function(element) { return $(#type).val() == S; } one function can return only one value at a time first one i.e. 'p' one to execute 's' one use above two functions . hope this will work ;) regards Ragx On Mon, Feb 9, 2009 at 1:27 PM, koszu rafal.kos...@izbarzem.opole.pl wrote: I'm using jquery validate plugin and I have a problem with rules depending of form selectors. In my form I have got two form selectors: select name=client.clientType id=type class=iefixmarginoption value=-- Wybierz --/option option value=BBezrobotny/option option value=NNieaktywny zawodowo/option option value=ZZatrudniony/option option value=IInny/option option value=PPrzedsiebiorstwo/option option value=SSamozatrudnony/option/select and input name=clientnip id=clientnip maxlength=14 value= class=tekst type=text I'd like to make clientnip required if type value is P or S. I tried this: $(#clientnip).rules(add, { required: function(element) { return $(#type).val() == P; return $(#type).val() == S; } It works for type value = P and ignore S. Could some one help me?
[jQuery] Re: what could be causing this isnull error ( realy weird )
so you dont get the other errors? i dont get this error i will look at it. All im interested in is why i get the isnull errors because these just are not null they do excist and if they dont excist that they should just be skipped. So there must be something else generating the error and That I cannot find out On Mon, Feb 9, 2009 at 1:34 PM, Stephan Veigl stephan.ve...@gmail.comwrote: Hi, I got an error in line 267 because of the quote;s in the javascript function. Try to replace it with single quotes. input type=submit name=dnn$ctr579$Login$Login_DNN$cmdLogin value=Inloggen onclick=javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('dnn$ctr579$Login$Login_DNN$cmdLogin', '', true, '', '', false, false)) id=dnn_ctr579_Login_Login_DNN_cmdLogin class=StandardButton / by(e) Stephan 2009/2/9 Armand Datema nok...@gmail.com: HI Well it cant be more simple than this it just tries to get the element with the class .grid-8 which is on the page for sure On Mon, Feb 9, 2009 at 1:06 PM, Mohd.Tareq tareq.m...@gmail.com wrote: Hi, May be its not able get the value for ur function ($(.grid_8) ); declare it on top of ur method . See this hope sol this will work regards Ragx On Mon, Feb 9, 2009 at 5:30 PM, Armand Datema nok...@gmail.com wrote: Hi http://www.howardsplaza.nl If you go to this page in firebug you see an isnull error. the same goes if you click the test click link. Why does this generate the isnull error. The fist one is indeed only on page after user is logged in but that should not be an issue . But the text click link tries to hide a few div with classes that are actually one the page any help would be appreciated since it appears i must be overlooking somthing -- ---| Regard |--- Mohd.Tareque -- Armand Datema CTO SchwingSoft -- Armand Datema CTO SchwingSoft
[jQuery] Re: what could be causing this isnull error ( realy weird )
Hi, I got an error in line 267 because of the quote;s in the javascript function. Try to replace it with single quotes. input type=submit name=dnn$ctr579$Login$Login_DNN$cmdLogin value=Inloggen onclick=javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('dnn$ctr579$Login$Login_DNN$cmdLogin', '', true, '', '', false, false)) id=dnn_ctr579_Login_Login_DNN_cmdLogin class=StandardButton / by(e) Stephan 2009/2/9 Armand Datema nok...@gmail.com: HI Well it cant be more simple than this it just tries to get the element with the class .grid-8 which is on the page for sure On Mon, Feb 9, 2009 at 1:06 PM, Mohd.Tareq tareq.m...@gmail.com wrote: Hi, May be its not able get the value for ur function ($(.grid_8) ); declare it on top of ur method . See this hope sol this will work regards Ragx On Mon, Feb 9, 2009 at 5:30 PM, Armand Datema nok...@gmail.com wrote: Hi http://www.howardsplaza.nl If you go to this page in firebug you see an isnull error. the same goes if you click the test click link. Why does this generate the isnull error. The fist one is indeed only on page after user is logged in but that should not be an issue . But the text click link tries to hide a few div with classes that are actually one the page any help would be appreciated since it appears i must be overlooking somthing -- ---| Regard |--- Mohd.Tareque -- Armand Datema CTO SchwingSoft
[jQuery] Re: what could be causing this isnull error ( realy weird )
Hi, with the Web version I got the null error as well. So I made a local copy to see where it came from. Then Aptana complaint about the quotes in the javascript call. I also replaced jQuery with my local version (1.3.1) and removed your last script (dnn.controls.toolbars...) because dnn was not defined in my local copy. With this little modifications the local copy has no error any more (of course without CSS and actually doing anything, but at least no null errors any more) by(e) Stephan 2009/2/9 Armand Datema nok...@gmail.com: so you dont get the other errors? i dont get this error i will look at it. All im interested in is why i get the isnull errors because these just are not null they do excist and if they dont excist that they should just be skipped. So there must be something else generating the error and That I cannot find out On Mon, Feb 9, 2009 at 1:34 PM, Stephan Veigl stephan.ve...@gmail.com wrote: Hi, I got an error in line 267 because of the quote;s in the javascript function. Try to replace it with single quotes. input type=submit name=dnn$ctr579$Login$Login_DNN$cmdLogin value=Inloggen onclick=javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('dnn$ctr579$Login$Login_DNN$cmdLogin', '', true, '', '', false, false)) id=dnn_ctr579_Login_Login_DNN_cmdLogin class=StandardButton / by(e) Stephan 2009/2/9 Armand Datema nok...@gmail.com: HI Well it cant be more simple than this it just tries to get the element with the class .grid-8 which is on the page for sure On Mon, Feb 9, 2009 at 1:06 PM, Mohd.Tareq tareq.m...@gmail.com wrote: Hi, May be its not able get the value for ur function ($(.grid_8) ); declare it on top of ur method . See this hope sol this will work regards Ragx On Mon, Feb 9, 2009 at 5:30 PM, Armand Datema nok...@gmail.com wrote: Hi http://www.howardsplaza.nl If you go to this page in firebug you see an isnull error. the same goes if you click the test click link. Why does this generate the isnull error. The fist one is indeed only on page after user is logged in but that should not be an issue . But the text click link tries to hide a few div with classes that are actually one the page any help would be appreciated since it appears i must be overlooking somthing -- ---| Regard |--- Mohd.Tareque -- Armand Datema CTO SchwingSoft -- Armand Datema CTO SchwingSoft
[jQuery] Re: .hasClass() not behaving as expected.
I tested your code here and works fine. I just ident your code to look better. On Mon, Feb 9, 2009 at 00:05, mkmanning michaell...@gmail.com wrote: In your code you're attaching the hover event to the anchor tags; in the sample html none of the anchors has a class (the class is on the parent li element). On Feb 8, 4:24 pm, MiD-AwE cr.midda...@gmail.com wrote: Please help, I've been wrestling with this for too long now. I've put together this code to change the background of a div when the mouse hovers over a list of divs. One of the listed divs has a class name of ash and I want to add a background image on that one hover; all of the other listed divs only have colors. The problem is that the .hasClass() doesn't seem to be behaving as it should, or I'm not doing something, or I'm just completely clueless? Below is my code and a sample html to test. Can someone please tell me what I'm doing wrong? Why is my $(this).hasClass('ash') not recognizing when my mouse hovers over the div with the class=ash? Thanks in advance, [code] !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; lang=en-us xml:lang= en-us head meta content=text/html; charset=UTF-8 http-equiv=content-type / titlemouseover color changer with preview/title script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/ jquery.min.js/script script type=text/javascript //![CDATA[ $(document).ready(function () { $.cstmzclrns = {clkclr : white};//$.cstmzclrns.clkclr $(#colors ul li a).hover( function () { if (!$(this).hasClass('ash')) { var color = $(this).css(background-color); $(#cfilter).css({'background-color' : color}); $(#cfilter).css({'background-image' : 'none'}); } else { $(#cfilter).css({'background-color' : 'transparent'}); $(#cfilter).css({'background-image' : 'url(img/ts/ash.png)'}); } }, function () { if ($.cstmzclrns.clkclr == 'ash') { $(#cfilter).css({'background-color' : 'transparent'}); $(#cfilter).css({'background-image' : 'url(img/ts/ash.png)'}); } else { $(#cfilter).css({'background-color' : $.cstmzclrns.clkclr}); $(#cfilter).css({'background-image' : 'none'}); } }).click( function () { if ($(this).hasClass('ash')) { $.cstmzclrns = {clkclr : ash}; $(#cfilter).css({'background-color' : 'transparent'}); $(#cfilter).css({'background-image' : 'url(img/ts/ ash.png)'}); } else { $.cstmzclrns = {clkclr : $(this).css(background-color)}; $(#cfilter).css({'background-color' : $.cstmzclrns.clkclr}); $(#cfilter).css({'background-image' : 'none'}); } });}); //]] /script style media=screen type=text/css body { background-color: black;} #cfilter { margin: 0px; padding: 0px; opacity: 0.503; position: absolute; width: 473px; height: 466px; display: block; right: 0px; top: 0px; float: right; z-index: 1; clear: none; background-color: white;} #customize { border: 3px solid #afa688; margin: 0px; padding: 10px 10px 10px 13px; font-size: 0.8em; font-family: Arial,Helvetica,sans-serif; display: block; float: left; clear: left; position: absolute; opacity: 0.899; background-color: #f4e2ab; color: black; width: 200px; top: 25px; z-index: 3;} #colors { border-style: solid; border-width: 1px; padding: 0px; position: relative; background-color: white; height: 21px; top: 9px; width: 137px; left: 31px; display: block;} #colors ul { border-style: none; border-width: 1px; list-style-type: none; position: relative; top: -11px; width: 99.9%; left: -39px; height: 99.9%;} #colors ul li { margin: 0px; padding: 0px; float: left;} #colors ul li a { border: 1px solid black; margin: 0px 0px 0px 2px; padding: 0px; height: 15px; display: block; list-style-type: none; list-style-position: inside; width: 15px; float: left;} /style /head body style=direction: ltr; div id=customizeMouse over color blocks to see the design in available colors. div id=colors ul li class=white a href=# style= background-color: white; color: white;./a /li li
[jQuery] Re: get visibility state after toggle()
Brian Here are a couple of demos that might help. http://jsbin.com/ojuju/edit Paul On Feb 9, 4:01 am, brian bally.z...@gmail.com wrote: How can I tell what the visibility state of an element is which has just been toggled? Is my selector no good or is it a matter of timing? . The situation is that I'm displaying a page of search results. I'd like the advanced search features to be present at the top but I'd prefer to hide them. So, I'm creating a link which will toggle the box display. What I haven't been able to figure out is how to swap the text of the link depending upon the state of the box. Or, rather, it will change to hide form the first time the box is displayed but remains that way ever after. Here's the code I'm working with: $(function() { $('#advanced_search').hide().after('a href=# id=toggle_formrefine search/a'); $('#toggle_form').css('float', 'right').click(function(e) { e.preventDefault(); $('#advanced_search').toggle('fast'); $(this).text($('#advanced_search:visible').length ? 'hide form' : 'refine search'); }); }); I also tried: $('#toggle_form').css('float', 'right').click(function(e) { e.preventDefault(); var search = $('#advanced_search'); search.toggle('fast'); $(this).text(search.css('display') == 'block' ? 'hide form' : 'refine search'); });
[jQuery] ui dialog
im not able to download the full package of ui dialog.moreover while trying to download themes error is being generated and i cannot extract files thanks all
[jQuery] Re: Calling ajax function with form submission
script language=javascript type=text/javascript src=jq.js/ script script language=javascript type=text/javascript function submitting() { $.ajax({ type: POST, url: some.php, data: name=Johnlocation=Boston, success: function(msg){ alert( Data Saved: + msg ); } }); return true; } /script form action=myaction.php method=post onsubmit=return submitting () input type=text name=name/br/br/ input type=text name=email/br/br/ input type=submit name=mysub value=Submit /form When i try to submit this form it directly goes to the action file of form that is myaction.php so without finishing the request sent to the some.php from the ajax call. To Resolve this i had put this attribute async: false in the above ajax call. that works however it takes a bit of time before the form starts submitting so this can be annoying for the users. In some.php i am retrieving the data and just sending an email. ALSO i don't wanna use javascript's submit() function. A better way to re-write this is without the onsubmit inline event handler. Remove that from the form tag and try this code: $(document).ready(function() { // bind submit event for your form $('form').submit(function() { // capture form data var data = $(this).serialize(); // post data to server $.ajax({ type: POST, url: some.php, data: data, success: function(msg){ alert( Data Saved: + msg ); } }); // prevent default browser submit behavior return false; }); });
[jQuery] Re: selector to return the number of rows in a table before the row I just selected
Oh yeah! Good point, Rob. I always forget these DOM properties. Thanks for the reminder. :) --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 9, 2009, at 2:37 AM, RobG wrote: On Feb 9, 4:23 am, pantagruel rasmussen.br...@gmail.com wrote: Hi, I am selecting the row of a table. I would like to be able to count how many rows there are in the table before the row I just selected. i suppose there is a jQuery selector that will do this. Not necessary - table rows have a rowIndex property, and since it's zero indexed: rowsBefore = row.rowIndex; URL: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-67347567 -- Rob
[jQuery] Re: list of metadata options?
Hmm, although the demo here: http://jquery.bassistance.de/validate/demo/ shows this example: input id=cname name=name class=required minlength=2 / So now I'm really confused. On Feb 8, 4:34 pm, Raymond Camden rcam...@gmail.com wrote: Hmm. So a min check is not available since it requires a value, but url is because it does. I guess that makes sense. But is that actually documented though? On Feb 8, 4:17 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: All documented methods are supported that way, with the exception of methods that require a parameter. Available methods are documented here:http://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation... Jörn
[jQuery] Re: Using jQuery Validation with Dot Net
Yes, it would be helpful. Can't really see what's going on in the snippet you provided. As Rob mentioned, there's no mention of the form (even though it is there on the page). It might give some additional clues as to where things have gone wrong. On Mon, Feb 9, 2009 at 3:46 AM, Jon cakeordeat...@gmail.com wrote: @ RobG: #aspnetForm is the form that wraps the whole of a dot net page. I simply posted the html snippet from the form itself. Individual forms do not have their own form tags, there is one large one that encloses the whole page - part of the dot net infrastructure. @ Aaron Grundel: No, but i will put one up tonight if it will help. I'm eager to use this validation plugin! On Feb 9, 2:14 am, RobG rg...@iinet.net.au wrote: On Feb 9, 8:30 am, Jon cakeordeat...@gmail.com wrote: I'm having issues getting the validation plugin (http://bassistance.de/ jquery-plugins/jquery-plugin-validation/) to work with dot net. Whatever i try i can't stop the form from submitting. I've tried several things i've found on this group and the web. Can anyone help me getting this to work? Here's my html. span id=ctl00_Control_LeftColumn_CF_Contact class=ContactForm p class=SuccessMessageSubmitted/p span class=Field span class=LabelName /span span class=Validation span id=ctl00_Control_LeftColumn_CF_Contact_ctl01_ctl04 style=display: none;/ /span input id=ctl00_Control_LeftColumn_CF_Contact_ctl01_TB_TextBox class=TextBox Name type=text name=ctl00$Control_LeftColumn $CF_Contact$ctl01$TB_TextBox/ /span span class=Field /span span class=Field /span a id=ctl00_Control_LeftColumn_CF_Contact_LB_Submit class=Submit href=javascript:__doPostBack('ctl00$Control_LeftColumn$CF_Contact $LB_Submit','') style=background-color: rgb(51, 51, 51);Submit/a /span Invalid markup, there is no form. And here is my javascript: $(document).ready(function(){ $(#aspnetForm).validate({ Where is #aspnetForm? -- Rob
[jQuery] Re: list of metadata options?
To add to this, I'm just playing around, but found that this too works: input id=cage name=cage size=4 class=required number min=1 max=100 / This is pretty slick, but I'd still like to know what the official documentation has to say about this. On Feb 9, 8:36 am, Raymond Camden rcam...@gmail.com wrote: Hmm, although the demo here:http://jquery.bassistance.de/validate/demo/ shows this example: input id=cname name=name class=required minlength=2 / So now I'm really confused. On Feb 8, 4:34 pm, Raymond Camden rcam...@gmail.com wrote: Hmm. So a min check is not available since it requires a value, but url is because it does. I guess that makes sense. But is that actually documented though? On Feb 8, 4:17 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: All documented methods are supported that way, with the exception of methods that require a parameter. Available methods are documented here:http://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation... Jörn
[jQuery] Re: test for css selector capability?
jQuery.browser is deprecated in 1.3 + (don't use it). JQuery now uses feature detection. This is a more extensible way of detecting which browser is being utilized. See the following page for more details... http://docs.jquery.com/Utilities/jQuery.support On Mon, Feb 9, 2009 at 4:02 AM, Mohd.Tareq tareq.m...@gmail.com wrote: Hi Geuis, Ther is a function with alias ($.browser) it will gives u functionality to identify browser name like this $.browser.mozilla , $.browser.msie , $.browser.opera , $.browser.safari. if u wana return the version of browser , then u have use below function $.browser.version it will return version of current browser according to ur problem ie6 u can add css on the fly. hope this will work . cheers cioa On Mon, Feb 9, 2009 at 11:47 AM, Geuis geuis.te...@gmail.com wrote: I'm working on a project where I need to detect if the browser natively supports a given CSS selector. For example, if I am using the selector 'ul li:first-child', this is supported by IE7, FF, and Safari but not by IE6 and below. Is there a way that I can test that selector to see if the current browser supports it? A feature that returns a simple boolean status would be awesome. -- ---| Regard |--- Mohd.Tareque
[jQuery] Re: Passing a Index to a function
I check these two solutions it didn't work ... On Feb 8, 11:42 pm, RobG rg...@iinet.net.au wrote: On Feb 9, 4:54 pm, Pedram pedram...@gmail.com wrote: Dear folk, I want to get the index of the TR and send it to the Function , I don't know how to it . this is what I'm trying to do $(table tr).bind(click,{IndexName:$(this).index(this)},clickFunc) The DOM 2 HTML TR.rowIndex property should do the job. -- Rob
[jQuery] Re: Optimize large DOM inserts
I made a post named 5 easy tips on how to improve code performance with huge data sets in jQuery here: http://jquery-howto.blogspot.com/2009/02/5-easy-tips-on-how-to-improve-code.html It gives 5 tips on howto work and improve performance while working with huge datasets. I hope you'll find it helpfull... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Mon, Feb 9, 2009 at 12:20 AM, Kevin Dalman kevin.dal...@gmail.com wrote: Rick, based on what I've learned from testing, you have another option now... Here is a modified version of Mike's code - without generating the table. function populateDutyTable(response) { var currentDay = ''; var rows = response.QGETDUTYSCHEDULE.DATA; var out = [], o = -1; out[++o] = 'tbody'; // CHANGED for( var row, i = -1; row = rows[++i]; ) { var day = row[1]; if( currentDay != day ) { currentDay = day; out[++o] = 'trtd class=cell-day'; out[++o] = row[1]; out[++o] = '/tdtd class=cell-date'; out[++o] = row[2]; out[++o] = '/tdtd class=cell-blank colspan=5nbsp;/td/tr'; } out[++o] = 'trtd class=cell-blank-daynbsp;/tdtd class=cell-blank-datenbsp;/tdtd class=cell-am-am'; out[++o] = row[3]; out[++o] = '/tdtd class=cell-position'; out[++o] = row[4]; out[++o] = '/tdtd colspan=3Cell Content/td/tr'; } out[++o] = '/tbody'; // CHANGED $('#scheduleBody').append( out.join('') ); // CHANGED } A container around the table is no longer required because wrapping the rows in a tbody achieves the same performance as wrapping them in a table. Plus, you could now add rows without regenerating the entire table. This provides more options with no penalty. For example, now you could hard-code the table with column headers - for example... table id=scheduleBody thead tr thID/th thDay/th thDate/th thName/th /tr /thead /table This is cleaner and faster than adding column headers inside your Javascript loop. I suggest you try both methods, Rick. Use a timer (like MIike's sample pages) to confirm whether both are equally fast. Based on my tests, you may find appending to the table even faster, with cleaner markup as a bonus. Ciao, /Kevin On Feb 7, 3:20 pm, Rick Faircloth r...@whitestonemedia.com wrote: Hey, thanks Michael for taking the time to provide the explanation and the re-write. I'll put this into place and see how it performs. I'm sure it'll be *much* better! Rick
[jQuery] attr feature
Does the attr feature let me capture my own attribute inside a element. I am trying and it doesnt seem to be working. I just wondering if there was a way to do this. Thanks -Tom
[jQuery] Problems with the simple jquery suckerFish menu?
Hi there, I am having problems with the suckerFish menu if i copy the code and let the font-size be 22px all is good: bldd.nl/jsproblems/menuTest2.html please rollover item3 but when i use a smaller font bldd.nl/jsproblems/menuTest2.html and you roll a couple of times over item3, i can't select the dropdown menu, it disappears??? How can i fix this???
[jQuery] Re: attr feature
Maybe showing an example of what isn't working would help others help you On Feb 9, 10:28 am, Tom Shafer tom.sha...@gmail.com wrote: Does the attr feature let me capture my own attribute inside a element. I am trying and it doesnt seem to be working. I just wondering if there was a way to do this. Thanks -Tom
[jQuery] Re: attr feature
sorry about that $('#projectid').attr('link') this is going into ajax post On Feb 9, 10:59 am, MorningZ morni...@gmail.com wrote: Maybe showing an example of what isn't working would help others help you On Feb 9, 10:28 am, Tom Shafer tom.sha...@gmail.com wrote: Does the attr feature let me capture my own attribute inside a element. I am trying and it doesnt seem to be working. I just wondering if there was a way to do this. Thanks -Tom
[jQuery] Re: list of metadata options?
Classes for methods with no parameters, attributes for methods with parameters. Thats it. Jörn On Mon, Feb 9, 2009 at 4:15 PM, Raymond Camden rcam...@gmail.com wrote: To add to this, I'm just playing around, but found that this too works: input id=cage name=cage size=4 class=required number min=1 max=100 / This is pretty slick, but I'd still like to know what the official documentation has to say about this. On Feb 9, 8:36 am, Raymond Camden rcam...@gmail.com wrote: Hmm, although the demo here:http://jquery.bassistance.de/validate/demo/ shows this example: input id=cname name=name class=required minlength=2 / So now I'm really confused. On Feb 8, 4:34 pm, Raymond Camden rcam...@gmail.com wrote: Hmm. So a min check is not available since it requires a value, but url is because it does. I guess that makes sense. But is that actually documented though? On Feb 8, 4:17 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: All documented methods are supported that way, with the exception of methods that require a parameter. Available methods are documented here:http://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation... Jörn
[jQuery] [Validate] Example of custom rule w/ metadata only
I'm trying to work up a demo of a custom validation rule that uses metadata only. I've cobbled the following together but the custom rule never fires: script $(document).ready(function(){ jQuery.validator.addMethod(range_exp, function(value, element, params) { return this.optional(element) || ( (value = params[0] value = params[1]) || value == params[2] ); }, Please enter between {0} and {1} or {2}); $(#commentForm).validate(); }); /script input id=WBC_I type=text size=6 validate=range_exp:[ 1, 999,'ND' ] value= name=WBC_I/ Obviously I've stripped a bit out, but what am I missing here?
[jQuery] Re: Form Plugin with file upload
Thank you Mike for the quick response. I uploaded your latest version and am experiencing the same problem I had with v. 2.16 text only works just fine. using image attachment the form data does not get saved on the php end. the ajaxSubmit() makes it to the success call back even though it wasn't successful and my div ends up empty instead of containing the text sent back from my php script. Thank you again for working with me on this! I really appreciate it. Hopefully we'll get to the bottom of this. Susie BogusRed Sahim http://www.PaperDemon.com On Sun, Feb 8, 2009 at 7:12 PM, Mike Alsup mal...@gmail.com wrote: I just upgraded the plain page to the latest version of jquery and the form plugin. And I noticed that with the new version, it does not make it to the success callback and you'll see this when you submit the form it gets stuck on the loading... text This was likely a bug fix of some kind. But still my file uploads are not working in ajax. What should my next steps be? Susie BogusRed Sahimhttp://www.PaperDemon.com Hi Susie, Looks like I had a bug in that latest version of the plugin. Could you grab v2.21 and upload it to your test location? I can't do much debugging with the current one. http://www.malsup.com/jquery/form/jquery.form.js Thanks. Mike
[jQuery] Re: [Validate] Example of custom rule w/ metadata only
For that to work you need to load the metadata plugin and have it configured to use the validate-attribute for metadata. Can't that in your code anywhere. See http://jquery.bassistance.de/validate/demo/radio-checkbox-select-demo.html for an example: $.metadata.setType(attr, validate); Jörn On Mon, Feb 9, 2009 at 5:24 PM, Raymond Camden rcam...@gmail.com wrote: I'm trying to work up a demo of a custom validation rule that uses metadata only. I've cobbled the following together but the custom rule never fires: script $(document).ready(function(){ jQuery.validator.addMethod(range_exp, function(value, element, params) { return this.optional(element) || ( (value = params[0] value = params[1]) || value == params[2] ); }, Please enter between {0} and {1} or {2}); $(#commentForm).validate(); }); /script input id=WBC_I type=text size=6 validate=range_exp:[ 1, 999,'ND' ] value= name=WBC_I/ Obviously I've stripped a bit out, but what am I missing here?
[jQuery] Re: list of metadata options?
Ahh, ok. That makes sense then. Thank you! On Feb 9, 10:23 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Classes for methods with no parameters, attributes for methods with parameters. Thats it. Jörn
[jQuery] input file and val()
Hi there, I tried to reset a file input element by using val(). html head titleFooBar/title /head script src=jquery.js/script script $(document).ready(function() { $(#resetMe).click(function () { $(#input1).val(''); }); }); /script body form name=foo input id=input1 type=file name=foobar brbr input id=resetMe type=button value=ResetMe! /form /body /html This works fine for FF, but IE doesn´t (re)set the value. Any hints? TIA ezod
[jQuery] Re: Next/Previous element in each loop
That's what I was hoping for, but next() and prev() act on the next and previous elements in the DOM, not in the nodes you're looping over. To demonstrate: $(p).each(function(i) { console.info($(this).next().html()); console.info($(this).prev().html()); }); form action=test.cfm method=post div p1/p div pThis is next/p /div /div div div pThis is previous/p /div p2/p /div div p3/p /div /form Maybe I have to come out to the outer most divs before calling next()/ prev() on it. Adrian On Feb 4, 4:16 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi, there are prev() and next() functions doing exactly what you need: $(div).each( function() { var prev = $(this).prev(); var next = $(this).next(); alert( prev.text() + - + next.text() ); }); (I've skipped the extra code for the first and last element for simplicity.) by(e) Stephan 2009/2/4AdrianLynchadely...@googlemail.com: Hey all, I'm loop over some nodes witheach() and I need to look at the next and previous elements for the current iteration. script type=text/javascript $(function() { $(div).each(function(i) { var prev = [SELECTOR FOR PREVIOUS DIV].text(); var next = [SELECTOR FOR NEXT DIV].text(); alert(prev + : + next); }); }); /script div1/div div2/div div3/div Will I have to store a reference to the divs and access it with i in the loop like this: script type=text/javascript $(function() { var divs = $(div); divs.each(function(i) { var prev = ; var next = ; if (i 0) prev = $(divs.get(i - 1)).text(); if (i divs.size() - 1) next = $(divs.get(i + 1)).text(); alert(prev + - + next); }); }); /script div1/div spanSpanner in the works/span div2/div spanDon't select me!/span div3/div Is next() the answer maybe?
[jQuery] Re: Select element based on a value of its child element
Cheers all. By the way Stephan, I'm gonna steal your sig! By(e) Adrian :OD On Feb 6, 9:16 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi, according to another thread in this group (http://groups.google.at/group/jquery-en/browse_thread/thread/2115a6c8...) there is already a ticket for this bug:http://dev.jquery.com/ticket/3990 and it's already fixed in the trunk by(e) Stephan 2009/2/6 jQuery Lover ilovejqu...@gmail.com: Most likely... you should submit a ticket:http://dev.jquery.com/ Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Wed, Feb 4, 2009 at 9:24 PM, Stephan Veigl stephan.ve...@gmail.com wrote: Good point. I've just tested input[value=''] and got an error in jQuery.js. Just tested it with other HTML attributes and got the same results. Empty attributes are not selected with a element[attr] and doing a element[attr=''] results in an error. Is this a bug? by(e) Stephan 2009/2/4AdrianLynchadely...@googlemail.com: Nice one! Should have spotted :has()... I've asked this in another thread but I'll slip it in here too, does the selector... input[value=''] ... work for any of you? Adrian On Feb 4, 12:11 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi, just a little remark: add a child selector '' before the 'input' or you will select surrounding divs as well. $(div:has(input[value='2'])) by(e) Stephan 2009/2/4 Mauricio (Maujor) Samy Silva css.mau...@gmail.com: $('div:has(input[value=2])') Maurício -Mensagem Original- De: AdrianLynch adely...@googlemail.com Para: jQuery (English) jquery-en@googlegroups.com Enviada em: quarta-feira, 4 de fevereiro de 2009 09:22 Assunto: [jQuery] Select element based on a value of its child element Hello all. I have the following... div input type=text value=1 / /div div input type=text value=2 / /div div input type=text value=3 / /div ... and I want to select the second div because its child input has a value of 2. I know I could select the input then come back to the div with parents (div). Just wondering if there's a way to do it in the selector string. More out of curiosity than need ;) Thanks. Adrian
[jQuery] Re: Next/Previous element in each loop
This explains better what I'm after: $(p).each(function(i) { var prevP = $(this).parent().prev().children(p); var nextP = $(this).parent().next().children(p); console.info(prevP.html()); console.info(nextP.html()); }); div p1/p div spanThis is next/span /div /div div div spanThis is previous/span /div p2/p /div div p3/p /div I want to refer to the next p in the each() loop but $(this).next()/ prev() refers to the next sibling element in the DOM. So in the example above I'm having to go out to the parent, then get the next/previous, then come in to get the p I want. Now I'm wondering if there's a generic way to do this... By(e) - see! Adrian On Feb 9, 4:44 pm, Adrian Lynch adely...@googlemail.com wrote: That's what I was hoping for, but next() and prev() act on the next and previous elements in the DOM, not in the nodes you're looping over. To demonstrate: $(p).each(function(i) { console.info($(this).next().html()); console.info($(this).prev().html()); }); form action=test.cfm method=post div p1/p div pThis is next/p /div /div div div pThis is previous/p /div p2/p /div div p3/p /div /form Maybe I have to come out to the outer most divs before calling next()/ prev() on it. Adrian On Feb 4, 4:16 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi, there are prev() and next() functions doing exactly what you need: $(div).each( function() { var prev = $(this).prev(); var next = $(this).next(); alert( prev.text() + - + next.text() ); }); (I've skipped the extra code for the first and last element for simplicity.) by(e) Stephan 2009/2/4AdrianLynchadely...@googlemail.com: Hey all, I'm loop over some nodes witheach() and I need to look at the next and previous elements for the current iteration. script type=text/javascript $(function() { $(div).each(function(i) { var prev = [SELECTOR FOR PREVIOUS DIV].text(); var next = [SELECTOR FOR NEXT DIV].text(); alert(prev + : + next); }); }); /script div1/div div2/div div3/div Will I have to store a reference to the divs and access it with i in the loop like this: script type=text/javascript $(function() { var divs = $(div); divs.each(function(i) { var prev = ; var next = ; if (i 0) prev = $(divs.get(i - 1)).text(); if (i divs.size() - 1) next = $(divs.get(i + 1)).text(); alert(prev + - + next); }); }); /script div1/div spanSpanner in the works/span div2/div spanDon't select me!/span div3/div Is next() the answer maybe?
[jQuery] Re: ui dialog
Can you please provide some more information, such as the steps you're taking, the operating system and browser version? Thanks. - Richard On Mon, Feb 9, 2009 at 7:07 AM, rani rani.bar...@gmail.com wrote: im not able to download the full package of ui dialog.moreover while trying to download themes error is being generated and i cannot extract files thanks all
[jQuery] Re: ui dialog
Also, which version you are trying to download. - Richard On Mon, Feb 9, 2009 at 11:58 AM, Richard D. Worth rdwo...@gmail.com wrote: Can you please provide some more information, such as the steps you're taking, the operating system and browser version? Thanks. - Richard On Mon, Feb 9, 2009 at 7:07 AM, rani rani.bar...@gmail.com wrote: im not able to download the full package of ui dialog.moreover while trying to download themes error is being generated and i cannot extract files thanks all
[jQuery] Re: input file and val()
File inputs have traditionally been difficult to modify, for security reasons. AFAIK, it shouldn't work in FF, either. Maybe it works only because you're emptying it. I wonder if that would work if you tried to set the value to some other string. On Mon, Feb 9, 2009 at 11:39 AM, ezod pured...@gmail.com wrote: Hi there, I tried to reset a file input element by using val(). html head titleFooBar/title /head script src=jquery.js/script script $(document).ready(function() { $(#resetMe).click(function () { $(#input1).val(''); }); }); /script body form name=foo input id=input1 type=file name=foobar brbr input id=resetMe type=button value=ResetMe! /form /body /html This works fine for FF, but IE doesn´t (re)set the value. Any hints? TIA ezod
[jQuery] Re: Does it hurt to call functions that don't do anything on the page?
@Nicolas - I'm curious as to why you find Ricardo's easiest? Ricardo's first solution would work, but to my mind adds extra complexity. You're adding a dependency on the presence of elements in the markup to execute your functions. If you work, as I currently do, in a multi-developer environment, it's very easy for someone to change the id of the element you're using, or perhaps remove it completely, which would immediately stop the functions from being called. They could also add that element to a page using a different identifier, and now that page would match two of Ricardo's if statements, calling functions that won't exist and so you're back to the original issue. This latter condition means you have to make sure you have a unique identifier element for every page, or follow Ricardo's second suggestion and use a unique class on the body tag of every page. One thing not apparent in his example is that the user may want multiple functions to run on each page, for example: page 1: functions 1,2, 4 page 2: functions 3,4 6 etc. This increases the complexity of the if statements and which functions go where, and seems more likely to break over time as functions get added or removed. My suggestion of just keeping an array of functions in one location (the external js), and checking for the presence of the function on domready and executing it if found, rather than a 'middle-man' element that has to stand in for one or more functions, seems much more direct--to me at least :) Maybe I'm missing something that makes Ricardo's seem to be easiest? On Feb 9, 2:26 am, Nicolas R ruda...@googlemail.com wrote: I not sure if this suits you, but you could split your functions to separate files and then lazy load each js file as necessary. In such casehttp://nicolas.rudas.info/jQuery/getPlugin/may be helpful Otherwise I find Ricardo's suggestion the easiest. You could also do some time tests to check whethercallingthese functions when not really needed effects performance, and act accordingly On Feb 9, 3:33 am, mkmanning michaell...@gmail.com wrote: *Tab+spacebar and it posts :P You could put your list of functions in an array in your external js, then call them on the window object in a loop: $(function() { var funcs = [ 'ManageCategoriesClick', 'HideByDefault', 'PrepareSplitForm', 'SetUpAdvertPopup', 'CheckAll', 'CheckNone', 'EditCategoryInPlace', 'PreparePaneLinks', 'PrepareToolTips' ] $.each(funcs,function(i,f){ if(typeof(window[f]) == 'function'){ window[f](); } }); }); On Feb 8, 5:21 am, Beau zar...@gmail.com wrote: Thanks for the ideas everyone! @Stephan: Yes, it's in an external JS file. I'd prefer to not have to do any inline javascript. I've considered it, but thanks for the suggestion! @Ricardo: Thanks for those. I may end up doing a variation of them. On Feb 8, 4:50 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi I guess you have your $().ready()functionin an external js file, otherwise you could customize it for the according html page. Another construct similar to Ricardos one, but a bit more flexible: Use a global variable in every html file to specify the init functions you want to call for this page: script type=text/javascript myInitFxn = [ManageCategoriesClick, HideByDefault, PrepareSplitForm,...]; /script ready.js: $().ready(function(){ for(var i in myInitFxn) { myInitFxn[i](); // call initfunction } }); by(e) Stephan 2009/2/8 brian bally.z...@gmail.com: On Sat, Feb 7, 2009 at 11:21 PM, Ricardo Tomasi ricardob...@gmail.com wrote: Alternatively you could add a different class to the body of each page, then use this rather amusing construct: $(document).ready((function(){ var is =function(v){ return ++document.body.className.indexOf(v) }; return( is('categories') ? ManageCategoriesClick : is('hidebydefault') ? HideByDefault : is('form') ? PrepareSplitForm : is('advert') ? SetUpAdvertPopup : function(){} //nothing ); })()); That is, indeed, amusing. And one for my toy chest. Thanks! Who knew, back in '96, that javascript was going to turn out to be so much fun?
[jQuery] Re: Jquery pagination plugin problem
There are a lot of ways to do it, here is a simple solution, of course 'length' will have to be determined somehow. var items_per_page = 10; var length = 1000; function pageSelectCallback(page_index, container){ $(#contentarea).load(url,{page:page_index}) return false; } $(#pagination).pagination(length,{ callback: pageSelectCallback, items_per_page:items_per_page }); On Feb 8, 1:51 pm, deviateDesigns dustin.good...@gmail.com wrote: How would set this up with list items and pulling from a external html file? I am new to using this library. On Feb 6, 8:28 pm, nate laws natel...@gmail.com wrote: I just tried this plugin for the first time today. The think to realize is that it does not directly have anything to do with which items and how many are displayed. Instead it only controls the pagination links. You have to manually display whichever items you want to be shown in the callback function. demo_options.htm shows one way of doing it when grabbing from am array. Personally I use a method like: var items_per_page = 10; function pageSelectCallback(page_index, container){ $(table tr).hide(); var start = page_index * items_per_page; $(table tr:gt(+start+):lt(+items_per_page+)).show() return false; } On Feb 6, 2:49 pm, deviateDesigns dustin.good...@gmail.com wrote: I am having the same issue not sure what is the issue still researching looks like the items_per_page is passing only a 1. On Jan 26, 4:53 am, Andy789 e...@abcstudio.com.au wrote: Hi all, I am playing with thepaginationplugin(http://plugins.jquery.com/ node/5912) and cannot figure out how to change number of items showing on a single page. Changing the param items_per_page changes the number of page links (navigation), but still shows a single item on a page. You may play with the demo.htm from the download to see what I am talking about.. Has someone faced the sameproblem? Any suggestions how to fix this?
[jQuery] Re: Does it hurt to call functions that don't do anything on the page?
I think the issue is that all of the functions are declared on the same external JS file. So you can't check for the function itself, as it will always exist, you need to check for some condition in the page. All of this will be inside $(document).ready on the external file. There are many other possibilities, a meta tag, using the title or any other text/element on the page. The choice boils down to how the whole site/app is structured and development practices in use. cheers, - ricardo On Feb 9, 3:29 pm, mkmanning michaell...@gmail.com wrote: @Nicolas - I'm curious as to why you find Ricardo's easiest? Ricardo's first solution would work, but to my mind adds extra complexity. You're adding a dependency on the presence of elements in the markup to execute your functions. If you work, as I currently do, in a multi-developer environment, it's very easy for someone to change the id of the element you're using, or perhaps remove it completely, which would immediately stop the functions from being called. They could also add that element to a page using a different identifier, and now that page would match two of Ricardo's if statements, calling functions that won't exist and so you're back to the original issue. This latter condition means you have to make sure you have a unique identifier element for every page, or follow Ricardo's second suggestion and use a unique class on the body tag of every page. One thing not apparent in his example is that the user may want multiple functions to run on each page, for example: page 1: functions 1,2, 4 page 2: functions 3,4 6 etc. This increases the complexity of the if statements and which functions go where, and seems more likely to break over time as functions get added or removed. My suggestion of just keeping an array of functions in one location (the external js), and checking for the presence of the function on domready and executing it if found, rather than a 'middle-man' element that has to stand in for one or more functions, seems much more direct--to me at least :) Maybe I'm missing something that makes Ricardo's seem to be easiest? On Feb 9, 2:26 am, Nicolas R ruda...@googlemail.com wrote: I not sure if this suits you, but you could split your functions to separate files and then lazy load each js file as necessary. In such casehttp://nicolas.rudas.info/jQuery/getPlugin/maybe helpful Otherwise I find Ricardo's suggestion the easiest. You could also do some time tests to check whethercallingthese functions when not really needed effects performance, and act accordingly On Feb 9, 3:33 am, mkmanning michaell...@gmail.com wrote: *Tab+spacebar and it posts :P You could put your list of functions in an array in your external js, then call them on the window object in a loop: $(function() { var funcs = [ 'ManageCategoriesClick', 'HideByDefault', 'PrepareSplitForm', 'SetUpAdvertPopup', 'CheckAll', 'CheckNone', 'EditCategoryInPlace', 'PreparePaneLinks', 'PrepareToolTips' ] $.each(funcs,function(i,f){ if(typeof(window[f]) == 'function'){ window[f](); } }); }); On Feb 8, 5:21 am, Beau zar...@gmail.com wrote: Thanks for the ideas everyone! @Stephan: Yes, it's in an external JS file. I'd prefer to not have to do any inline javascript. I've considered it, but thanks for the suggestion! @Ricardo: Thanks for those. I may end up doing a variation of them. On Feb 8, 4:50 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi I guess you have your $().ready()functionin an external js file, otherwise you could customize it for the according html page. Another construct similar to Ricardos one, but a bit more flexible: Use a global variable in every html file to specify the init functions you want to call for this page: script type=text/javascript myInitFxn = [ManageCategoriesClick, HideByDefault, PrepareSplitForm,...]; /script ready.js: $().ready(function(){ for(var i in myInitFxn) { myInitFxn[i](); // call initfunction } }); by(e) Stephan 2009/2/8 brian bally.z...@gmail.com: On Sat, Feb 7, 2009 at 11:21 PM, Ricardo Tomasi ricardob...@gmail.com wrote: Alternatively you could add a different class to the body of each page, then use this rather amusing construct: $(document).ready((function(){ var is =function(v){ return ++document.body.className.indexOf(v) }; return( is('categories') ? ManageCategoriesClick : is('hidebydefault') ? HideByDefault : is('form') ? PrepareSplitForm : is('advert') ?
[jQuery] Can I use a reference to a select id in a function like this?
I have a select with id=agentSelect and onchange=updateDutyRecord(). Once I choose an option, can I reference the select and option like this? function updateDutyRecord() { $('#agentSelect', this).change(function() { $('option:selected', this).each(function() {
[jQuery] modify from server two jquery elements in the same time
I would like to modify two jquery elements in the same time from PHP module. The PHP module is called by .ajax $.ajax( { type: POST, url:'my_module.php', dataType: 'html', success: function(resultat) { * ? *}, error: function(requete,iderror) {alert(iderror);} }) } div id=field1... div id=field2... PHP code: echo ***new value for field1 new value for field2 *** How to formulate the success function AND the echo instruction ?
[jQuery] Re: attr feature
I don't think it works. You might consider using the Metadata plugin: http://plugins.jquery.com/project/metadata or jQuery's jQuery.data: http://docs.jquery.com/Core/data to achieve what you want to do in a similar way. On Feb 9, 6:05 am, Tom Shafer tom.sha...@gmail.com wrote: sorry about that $('#projectid').attr('link') this is going into ajax post On Feb 9, 10:59 am, MorningZ morni...@gmail.com wrote: Maybe showing an example of what isn't working would help others help you On Feb 9, 10:28 am, Tom Shafer tom.sha...@gmail.com wrote: Does the attr feature let me capture my own attribute inside a element. I am trying and it doesnt seem to be working. I just wondering if there was a way to do this. Thanks -Tom
[jQuery] Re: modify from server two jquery elements in the same time
my_module.php ?php $myArray = array( 'var1' = 'hello', 'var2' = 'world' ); echo json_encode($myArray); ? helloWorld.html $.ajax( { type: POST, url:'my_module.php', dataType: 'json', // !-- I'VE CHANGED THIS TO RECEIVE JSON AS RESPONSE success: function(resultat) { $(#field1).text(resultat.var1); $(#field2).text(resultat.va21); }, error: function(requete,iderror) {alert(iderror);} }) } div id=field1/div div id=field2/div On Feb 9, 8:27 am, phicarre gam...@bluewin.ch wrote: I would like to modify two jquery elements in the same time from PHP module. The PHP module is called by .ajax $.ajax( { type: POST, url:'my_module.php', dataType: 'html', success: function(resultat) { * ? *}, error: function(requete,iderror) {alert(iderror);} }) } div id=field1... div id=field2... PHP code: echo ***new value for field1 new value for field2 *** How to formulate the success function AND the echo instruction ?
[jQuery] Re: Does it hurt to call functions that don't do anything on the page?
Ah, I have misread it then; I was under the impression the calls to the function were on the external page, but the functions themselves were on separate pages. Thanks for clearing that up. On Feb 9, 9:47 am, Ricardo Tomasi ricardob...@gmail.com wrote: I think the issue is that all of the functions are declared on the same external JS file. So you can't check for the function itself, as it will always exist, you need to check for some condition in the page. All of this will be inside $(document).ready on the external file. There are many other possibilities, a meta tag, using the title or any other text/element on the page. The choice boils down to how the whole site/app is structured and development practices in use. cheers, - ricardo On Feb 9, 3:29 pm, mkmanning michaell...@gmail.com wrote: @Nicolas - I'm curious as to why you find Ricardo's easiest? Ricardo's first solution would work, but to my mind adds extra complexity. You're adding a dependency on the presence of elements in the markup to execute your functions. If you work, as I currently do, in a multi-developer environment, it's very easy for someone to change the id of the element you're using, or perhaps remove it completely, which would immediately stop the functions from being called. They could also add that element to a page using a different identifier, and now that page would match two of Ricardo's if statements, calling functions that won't exist and so you're back to the original issue. This latter condition means you have to make sure you have a unique identifier element for every page, or follow Ricardo's second suggestion and use a unique class on the body tag of every page. One thing not apparent in his example is that the user may want multiple functions to run on each page, for example: page 1: functions 1,2, 4 page 2: functions 3,4 6 etc. This increases the complexity of the if statements and which functions go where, and seems more likely to break over time as functions get added or removed. My suggestion of just keeping an array of functions in one location (the external js), and checking for the presence of the function on domready and executing it if found, rather than a 'middle-man' element that has to stand in for one or more functions, seems much more direct--to me at least :) Maybe I'm missing something that makes Ricardo's seem to be easiest? On Feb 9, 2:26 am, Nicolas R ruda...@googlemail.com wrote: I not sure if this suits you, but you could split your functions to separate files and then lazy load each js file as necessary. In such casehttp://nicolas.rudas.info/jQuery/getPlugin/maybe helpful Otherwise I find Ricardo's suggestion the easiest. You could also do some time tests to check whethercallingthese functions when not really needed effects performance, and act accordingly On Feb 9, 3:33 am, mkmanning michaell...@gmail.com wrote: *Tab+spacebar and it posts :P You could put your list of functions in an array in your external js, then call them on the window object in a loop: $(function() { var funcs = [ 'ManageCategoriesClick', 'HideByDefault', 'PrepareSplitForm', 'SetUpAdvertPopup', 'CheckAll', 'CheckNone', 'EditCategoryInPlace', 'PreparePaneLinks', 'PrepareToolTips' ] $.each(funcs,function(i,f){ if(typeof(window[f]) == 'function'){ window[f](); } }); }); On Feb 8, 5:21 am, Beau zar...@gmail.com wrote: Thanks for the ideas everyone! @Stephan: Yes, it's in an external JS file. I'd prefer to not have to do any inline javascript. I've considered it, but thanks for the suggestion! @Ricardo: Thanks for those. I may end up doing a variation of them. On Feb 8, 4:50 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi I guess you have your $().ready()functionin an external js file, otherwise you could customize it for the according html page. Another construct similar to Ricardos one, but a bit more flexible: Use a global variable in every html file to specify the init functions you want to call for this page: script type=text/javascript myInitFxn = [ManageCategoriesClick, HideByDefault, PrepareSplitForm,...]; /script ready.js: $().ready(function(){ for(var i in myInitFxn) { myInitFxn[i](); // call initfunction } }); by(e) Stephan 2009/2/8 brian bally.z...@gmail.com: On Sat, Feb 7, 2009 at 11:21 PM, Ricardo Tomasi ricardob...@gmail.com wrote: Alternatively you could add a different class to the body of each page, then use this
[jQuery] Access tabs from an iframe to another.
Hallo all. I got a problem accessing .ui-tabs-nav defined in an iframe from another one. I have a index page where I define an iframe: inside the iframe is loaded a page where are defined the tabs. http://pastie.org/384171 In index.html there is this piece of code http://pastie.org/384170 Then I load a modal dialog with an iframe inside (using jquery DOMwindow); now that i got this iframe I need to change the tab content, but i cannot access the tab class to do it. Normally inside the iframe where are defined the tabs I use this piece of code to reload a tab http://pastie.org/384176 I tried different ways to do the same thing in the other iframe as described here http://pastie.org/384179 but with no result. Any idea how to solve this problem? Kind regards Massimo UGues
[jQuery] Custom data property in custom events
Hi, when triggering a custom event with some custom data, all my data is removed from the data-property on the event object. It's only available in the data parameter sent as the second parameter to the event handler. Even though I've created a custom event object and populated the data-property. Is this by design or is it a bug? $(document).bind(hepp, function(e, data) { alert(data.test + -- + (!e.data ? undefined : e.data.test)); }); $(function() { $(document).trigger(hepp, { test: hopp }); }); This always alerts hopp -- undefined. Thanks, Glenn
[jQuery] Callback from the $.post function is not being invoked
I'm new to jQuery and it has worked great for me... except I seem to be having a problem with the $.post function. The response comes back but the callback function is not invoked. Here is the loop that I'm using to set the onChange event handler: datafields = new Array( #field1, #field2, #field3 ) ; function edit_event_handlers( ) { for ( var target in datafields ) { $(datafields[target]).change( function(dft) { return function() { $(dft).css('background-color','orange') ; var params = { fieldname: dft.replace(#,), fieldval: $(dft).val() } $.post(/index.php/Workflow_server/updatefield/, params, function(){ alert(Data returned) ; }, xml ) ; } ; }(datafields[target]) ) ; } ; } Using firebug I see the params are sent to the server process and the xml data is returned: (it just wraps $_POST in test tags) testarray(2) { [fieldname]= string(7) #field1 [fieldval]= string(6) 345345 } /test ... but the alert in the function never appears. I also tried this line for the function parameter of the $.post call without success: function() { return function(rdata){ alert(Data returned: + rdata) } } What am I missing here? Thanks, Eric
[jQuery] Image annotation
Hello everyone! Does anybody know of a jquery plugin/script implementing image annotation? I'm looking for something similar to Fotonotes (http://www.fotonotes.net/), Photonotes (http://www.dustyd.net/projects/PhotoNotes/), flickr's annotation etc. Thanks in advance, Leon. -- View this message in context: http://www.nabble.com/Image-annotation-tp21918327s27240p21918327.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Can I use a reference to a select id in a function like this?
Yep, you have the right idea. I would do this: $(function(){ $('#agentSelect').change(function(){ var element = $('option:selected',this); // do whatever you need to do with the element console.debug(element.val()); }); }); On Feb 9, 12:48 pm, Rick Faircloth r...@whitestonemedia.com wrote: I have a select with id=agentSelect and onchange=updateDutyRecord(). Once I choose an option, can I reference the select and option like this? function updateDutyRecord() { $('#agentSelect', this).change(function() { $('option:selected', this).each(function() {
[jQuery] Getting Style Information (left/top)
Hello, I'm a(nother?) new person to Jquery and have found it to be *excellent* so far (when I say that I may be understating how damned awesome it is!!) There is only one thing that has been bothering me - I can't seem to find a way of finding a position of an item with an easy Jquery shortcut. i.e. to find out the style.top value of an element, I have to use the following : document.getElementById(TheDivInQuestion).style.top Am I missing something that does this with something like : $ (#TheDivInQuestion).top or $(#TheDivInQuestion).style.top :? (both of which don't work for me..) Thanks in advance, Paul Hutson
[jQuery] Re: Problems with the simple jquery suckerFish menu?
Hi, is there any way you can provide a code sample of how you are using this? Thanks cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: 123gotoandplay wesweatyous...@gmail.com To: jQuery (English) jquery-en@googlegroups.com Date: 02/09/2009 10:59 AM Subject:[jQuery] Problems with the simple jquery suckerFish menu? Hi there, I am having problems with the suckerFish menu if i copy the code and let the font-size be 22px all is good: bldd.nl/jsproblems/menuTest2.html please rollover item3 but when i use a smaller font bldd.nl/jsproblems/menuTest2.html and you roll a couple of times over item3, i can't select the dropdown menu, it disappears??? How can i fix this??? inline: graycol.gifinline: ecblank.gif
[jQuery] Safe Ajax Calls?
Hi! I'm kind of new at the world of ajax and jquery and i'm starting to make a site with them. In my site i've created a single function (in the header) called ajaxQry(...) which takes some parameters like, url to make post or get, if I need GEt or POST, the data type of the query, a success function and an error function. Anyway, it look like this: function ajaxQry(sendVars, url, returnType, backFunction, errorFunction){ $.ajax({ type: POST, url: ajax/+url+.asp?nocache=+Math.random(), data: sendVars, success: backFunction, //ussully this loads the content in the main page as html dataType: returnType, error: errorFunction }); } Everything works great but i don't know if there's a better way to do this, because in many events of the site I call this function... And I'm starting to think that it's pretty insecure What do you think? By the way i ussually call the url file (see the function) and return HTML content, and then i load it in the page with $(selector).html(); is that okay? Thanks! and sorry for my english :$
[jQuery] appying addClass to proper element (jquery 1.1 - jquery 1.3.)
Hello, I'm doing a modification on a javascript that is written for jquery 1.1 and wont work with jquery 1.3. Heres is the shortened original code: stars = $(div.star, obj), ... stars.lt(rating[0]).addClass(on); //critical line that causes error I changed the line above to: $(div.star:lt( + parseInt(rating[0]) + )).addClass(on); which seems to work with jquery but it wont apply addClass to the proper div.star element (if there are more than 1 div.star-s in the html. I'm wondering how should I change it so that it would apply properly to the appropriate element? Maybe something like: stars.$(.. I have no idea how to get the lt within a object (star) ? rating[0] is just an integer with current rating value.ž I hope someone can help me. Many thanks in advance!
[jQuery] Re: attr feature
This works fine for me (using jQuery 1.3): $(function(){ $('div').attr('id','test').html('div html').appendTo ('body'); // inject html element, also works fine hard-coded. $('#test').attr('ryantest','hithere'); $('a').click(function(event){ event.preventDefault(); alert($('#test').attr('ryantest')); }); }); Alerts 'hithere' when you click a link. On Feb 9, 10:28 am, Tom Shafer tom.sha...@gmail.com wrote: Does the attr feature let me capture my own attribute inside a element. I am trying and it doesnt seem to be working. I just wondering if there was a way to do this. Thanks -Tom
[jQuery] Re: modify from server two jquery elements in the same time
What? Sorry, but this is hard to understand. I believe you're trying to set element data from a value in a php file, right? If so, that's pretty easy using JSON. In PHP, json_encode() converts an array or object into a string, and in Javascript it takes that string and converts it to an object. Using the json dataType in jQuery.ajax, the success param will be the object converted from string to an object. The object keys will be the values from the PHP array. jQuery: $.ajax({ type: 'POST', url: 'ajax.php', dataType: 'json', success: function(jdata){ $('#element1').text(jdata.value1); $('#element2').text(jdata.value2); } }); PHP: echo json_encode(array('value1' = 'i\'m value 1', 'value2' = 'i\'m value 2')); On Feb 9, 1:27 pm, phicarre gam...@bluewin.ch wrote: I would like to modify two jquery elements in the same time from PHP module. The PHP module is called by .ajax $.ajax( { type: POST, url:'my_module.php', dataType: 'html', success: function(resultat) { * ? *}, error: function(requete,iderror) {alert(iderror);} }) } div id=field1... div id=field2... PHP code: echo ***new value for field1 new value for field2 *** How to formulate the success function AND the echo instruction ?
[jQuery] Accordion newbie problem
Hi there. I don't know if it is the right place for that, sorry if not. I have a newbie problem. I've red the documentation but i can't find the solution. I have a page with 3 accordions, based on the demo script, so i have: jQuery().ready(function(){ // simple accordion jQuery('#list1a').accordion({ animated: easeslide, autoheight: true }); jQuery('#list1b').accordion({ animated: easeslide, autoheight: true }); jQuery('#list1c').accordion({ animated: easeslide, autoheight: true }); }); By default, the first element of each accordions is the one open. All i would like to do is to make the LAST one open at the beggining. Thanx for your time.
[jQuery] Re: Triggering a link with no click event
I was looking to do the same thing - I wanted to emulate the click() method, which doesn't work on all browsers. I have had any luck either. I was trying to open a file input browse view by clicking on another link. I can get it to work in IE and Safari, but Firefox doesn't support it on input[type=file] On Jan 31, 2:23 pm, Andy789 e...@abcstudio.com.au wrote: Guys, thank you, but it still does not work. 1) The Maurício's solution is just a way of extracting the href value and creating onlick event to jump to that link. What I need is to emulate aclickon the a element without opening a link directly. The reason for that: Rokbox scans all rel=rokbox elements and generates a set of divs bevore closing body tag. Somehow the links are binded with some internal RokBox functions, so clicking on the link opens a RokBox with the link target inside. 2) Yes, I am using both mootools and jquery with noConflict() declaration - it works perfectly 3) The problem is that I cannot find the function inside RokBox to call it directly from jscript function. At the same time I would rather prefer to use RokBox, because it works perfectly for complex independent pages with ajax, flash etc inside. RokBox creates an iframe inside. The point is that I need to find either a way of emulating the linkclickor a function inside RokBox, which is difficult, because it is packed any more ideas?
[jQuery] Re: Changing Colspans with Jquery, IE6
I dont know if this is what you are talking about, but i think i was having the same problem. I had problems trying to change de colspan to a table's TD in IE, after doing many tests i found the way. Here is the jquery code: $('.G_HD0').attr({colSpan:3}); searching by class $('#td1').attr({colSpan:3}); searching by ID In the example i've search the TD by class, the problem with the IE was the way of writing COLSPAN... it must have a capital s as the example above. Sorry my english, im from Argentina. pijgu wrote: Hi guys, Hoping you can help me out. I've got a scenario where my table is as so: table tr thSection Heading/th tdSection content lots and lots of paragraphs.../td /tr tr thSection Heading/th tdSection content lots and lots of paragraphs.../td /tr /table The situation is that the table is collapsable. It works as so: 1. User clicks on th 2. corresponding td is hidden with jquery 3. colspan of th is set to 2 4. width of th is set to 100% If the row is collapsed when the user clicks on a th, then: 1. colspan of th is set to 1 2. width of th is set to 20% 3. td is shown 4. width of td is set to 80% This works fine on FF. However, on IE6 I am having the weird problem where once a row is expanded, the collapsed ths no longer extend to the edge of the table. It's almost as though the browser either hasn't reset the colspan (which it has - I've used the developer toolbar to check), or it thinks the td that I've hidden is still there. Does anyone know what might be causing this? Does ie6 still account for tds that have been hidden using display:none? -- View this message in context: http://www.nabble.com/Changing-Colspans-with-Jquery%2C-IE6-tp20592996s27240p21916136.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: selector to return the number of rows in a table before the row I just selected
Great discussion. Thanks for all. -- Nivash Ramachandran On Mon, Feb 9, 2009 at 7:19 PM, Karl Swedberg k...@englishrules.com wrote: Oh yeah! Good point, Rob. I always forget these DOM properties. Thanks for the reminder. :) --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 9, 2009, at 2:37 AM, RobG wrote: On Feb 9, 4:23 am, pantagruel rasmussen.br...@gmail.com wrote: Hi, I am selecting the row of a table. I would like to be able to count how many rows there are in the table before the row I just selected. i suppose there is a jQuery selector that will do this. Not necessary - table rows have a rowIndex property, and since it's zero indexed: rowsBefore = row.rowIndex; URL: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-67347567 -- Rob
[jQuery] Re: Problems with the simple jquery suckerFish menu?
I'm not sure if my previous response made it, trying to configure this to work with my work email. However, is there any way you can provide a code snippet of what you are trying to fix here? On Feb 9, 10:58 am, 123gotoandplay wesweatyous...@gmail.com wrote: Hi there, I am having problems with the suckerFish menu if i copy the code and let the font-size be 22px all is good: bldd.nl/jsproblems/menuTest2.html please rollover item3 but when i use a smaller font bldd.nl/jsproblems/menuTest2.html and you roll a couple of times over item3, i can't select the dropdown menu, it disappears??? How can i fix this???
[jQuery] malsup.com form and php validation confusion
Hi all, I'm using the jquery form plugin from malsup.com, and I'm confused about validation. I need to validate the form fields in the php file specified in the action of the form. I realise I can use the success: function() to update a div (I actually want to perform animation on a div elsewhere on the page) when successful, but if the form is incorrectly completed, how do I return a 'failed' code from the php file (so that the animation doesn't happen)? (It seems to me as though the form always returns 'successful' code ?) Thanks, Matt
[jQuery] Re: input file and val()
Have you tried using the attr() function? $(#input1).attr(value,);) cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: ezod pured...@gmail.com To: jQuery (English) jquery-en@googlegroups.com Date: 02/09/2009 11:40 AM Subject:[jQuery] input file and val() Hi there, I tried to reset a file input element by using val(). html head titleFooBar/title /head script src=jquery.js/script script $(document).ready(function() { $(#resetMe).click(function () { $(#input1).val(''); }); }); /script body form name=foo input id=input1 type=file name=foobar brbr input id=resetMe type=button value=ResetMe! /form /body /html This works fine for FF, but IE doesn´t (re)set the value. Any hints? TIA ezod inline: graycol.gifinline: ecblank.gif
[jQuery] jquery, OOP and this - Problem
Hello group, I got a problem with a JS class I am writing. I got the following piece of code: this.slide=function(){ $(this.container_selector_contents).fadeOut(1000, function(){ this.setContent(); this.fadeIn(1000) }); } The problem is, that inside the fadeOut() function this is now not the class but the jQuery element. So, how can I access my classes methods and variables again sine I can't use this? Thanks for your help!
[jQuery] Re: Triggering a link with no click event
Hi all, click() doesn't work on most browsers because of security reasons. Can you imagine giving some spam programmer the ability to simulate a mouse click? cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: solidhex patr...@solidhex.com To: jQuery (English) jquery-en@googlegroups.com Date: 02/09/2009 02:01 PM Subject:[jQuery] Re: Triggering a link with no click event I was looking to do the same thing - I wanted to emulate the click() method, which doesn't work on all browsers. I have had any luck either. I was trying to open a file input browse view by clicking on another link. I can get it to work in IE and Safari, but Firefox doesn't support it on input[type=file] On Jan 31, 2:23 pm, Andy789 e...@abcstudio.com.au wrote: Guys, thank you, but it still does not work. 1) The Maurício's solution is just a way of extracting the href value and creating onlick event to jump to that link. What I need is to emulate aclickon the a element without opening a link directly. The reason for that: Rokbox scans all rel=rokbox elements and generates a set of divs bevore closing body tag. Somehow the links are binded with some internal RokBox functions, so clicking on the link opens a RokBox with the link target inside. 2) Yes, I am using both mootools and jquery with noConflict() declaration - it works perfectly 3) The problem is that I cannot find the function inside RokBox to call it directly from jscript function. At the same time I would rather prefer to use RokBox, because it works perfectly for complex independent pages with ajax, flash etc inside. RokBox creates an iframe inside. The point is that I need to find either a way of emulating the linkclickor a function inside RokBox, which is difficult, because it is packed any more ideas? inline: graycol.gifinline: ecblank.gif
[jQuery] Re: Getting Style Information (left/top)
If you look at the documentation for jQuery you'll see that many jQuery functions either return jQuery itself, or an array of elements. Your usage would return an array of the element in question so you might want to try something like this $(#TheDivInQuestion)[0].style.top Hope that helps! cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: Paul Hutson hutsonphu...@googlemail.com To: jQuery (English) jquery-en@googlegroups.com Date: 02/09/2009 02:02 PM Subject:[jQuery] Getting Style Information (left/top) Hello, I'm a(nother?) new person to Jquery and have found it to be *excellent* so far (when I say that I may be understating how damned awesome it is!!) There is only one thing that has been bothering me - I can't seem to find a way of finding a position of an item with an easy Jquery shortcut. i.e. to find out the style.top value of an element, I have to use the following : document.getElementById(TheDivInQuestion).style.top Am I missing something that does this with something like : $ (#TheDivInQuestion).top or $(#TheDivInQuestion).style.top :? (both of which don't work for me..) Thanks in advance, Paul Hutson inline: graycol.gifinline: ecblank.gif
[jQuery] [autocomplete] display a loading gif
Hi, i need to show a loading gif while autoocmplete plugins make the ajax ask. is there anyway?
[jQuery] Re: jquery, OOP and this - Problem
just stay aware of the scope: var oldthis = this; this.slide=function(){ $(this.container_selector_contents).fadeOut(1000, function(){ oldthis.setContent(); oldthis.fadeIn(1000) }); } ; On Feb 9, 3:13 pm, Creativebyte michaelhaszpru...@googlemail.com wrote: Hello group, I got a problem with a JS class I am writing. I got the following piece of code: this.slide=function(){ $(this.container_selector_contents).fadeOut(1000, function(){ this.setContent(); this.fadeIn(1000) }); } The problem is, that inside the fadeOut() function this is now not the class but the jQuery element. So, how can I access my classes methods and variables again sine I can't use this? Thanks for your help!
[jQuery] Re: jquery, OOP and this - Problem
Did you try with $(this).setContent(); instead of this.setContent(); ? On 9 feb, 14:13, Creativebyte michaelhaszpru...@googlemail.com wrote: Hello group, I got a problem with a JS class I am writing. I got the following piece of code: this.slide=function(){ $(this.container_selector_contents).fadeOut(1000, function(){ this.setContent(); this.fadeIn(1000) }); } The problem is, that inside the fadeOut() function this is now not the class but the jQuery element. So, how can I access my classes methods and variables again sine I can't use this? Thanks for your help!
[jQuery] New jQuery Conditional Chain Plugin
Hey guys, I had an idea this morning which quickly turned into a small but, I think powerful, plugin. I'd love some review on it from the list, to see if anyone can see any glaring errors I missed, or has an easier/ already done way of doing it. The source code and some examples are located here: http://snipplr.com/view/12045/jquery-conditional-chains/ The basic idea was to add functionality to jQuery to conditionally execute functions on the chain, based on dynamic values. Take for example: $.ajax('url.php', function(data){ $('#result').cond(data.success, 'addClass', 'ui-state- highlight').cond(!data.success, 'addClass', 'ui-state-error'); }, 'json'); Instead of $.ajax('url.php', function(data){ if (result.data) $('#result').addClass('ui-state-highlight'); else $('#result').addClass('ui-state-error'); }, 'json'); Also, it has functionality to stop/resume the chain based on boolean variables. $.ajax('url.php', function(data){ $('#result') .stop(!data.success).addClass('ui-state-highlight').text('Success! Excelsior!') .resume(!data.success)).addClass('ui-state-error').text('Failure! Oh Noes!') }, 'json'); Thoughts? Comments? Ideas for improvement? What do ya'll think?
[jQuery] subclassing ajaxForm
When I try to do this, firebug does not alert me of anything wrong, the form is posted normally (no ajax). What mistake am I making? // requires jquery.forms plugin jQuery.fn.jsonForm = function(onSuccess) { this.ajaxForm({ dataType: 'json', success: function(data) { if (data.Message) { alert(data.Message); // my json reply always has these 2 fields } if (data.ActionUrl != null) { top.location = data.ActionUrl; } if (onSuccess != null) { onSuccess(data); // what if onSuccess has an empty signature? } } }); } So I can call it like so: var onSuccess = function(data){ $.each(data.Customer, function(i, item){ $('#searchResultCustomers').append(dd+ item.Name +/dd); }); }); $('.jsonFormCustomer').jsonForm(onSuccess); How could I call jsonForm without a null param, too? Help greatly appreciated!
[jQuery] table header order
HI, i have a table with thead, tbody and the headers (stored in thead) should be able to be moved to reorder the table. for example, if the 1st column is ID, the 2nd column is Name and 3rd one is firstname, i want user to be able to drag and drop column firstname between ID and Name columns. so the firstname would be the 2nd column now. how can i do that using jQuery ? thx. -- Alain --- Windows XP x64 SP2 / Fedora 10 KDE 4.2 PostgreSQL 8.3.5 / MS SQL server 2005 Apache 2.2.10 PHP 5.2.6 C# 2005-2008
[jQuery] Re: Next/Previous element in each loop
Hi Adrian, as mkmanning already said, when you want to get the next / prev element from the same selector, simply access the array. In this case I prefer a for (var i=0; ips.length; i++) {...} loop instead of the $.each for performance reasons and readability, but that's personal taste. by(e) :-) Stephan 2009/2/9 mkmanning michaell...@gmail.com: $(p) is an array, so you could just use the index: var ps = $(p); //cache ps.each(function(i,d) { var prevP = i0?$(ps[i-1]):false; /* however you want to deal with there not being a prev */ var nextP = ips.length-1?$(ps[i+1]):false; /* however you want to deal with there not being a next */ if(prevP){ console.log($(prevP).html()); } if(nextP){ console.log($(nextP).html()); } //if you only want p's that have a prev AND next, you can do this if(i0 ips.length-1){ console.log( $(ps[i-1]).html() + ', ' + $(ps[i+1]).html() ); } }); On Feb 9, 8:55 am, Adrian Lynch adely...@googlemail.com wrote: This explains better what I'm after: $(p).each(function(i) { var prevP = $(this).parent().prev().children(p); var nextP = $(this).parent().next().children(p); console.info(prevP.html()); console.info(nextP.html()); }); div p1/p div spanThis is next/span /div /div div div spanThis is previous/span /div p2/p /div div p3/p /div I want to refer to the next p in the each() loop but $(this).next()/ prev() refers to the next sibling element in the DOM. So in the example above I'm having to go out to the parent, then get the next/previous, then come in to get the p I want. Now I'm wondering if there's a generic way to do this... By(e) - see! Adrian On Feb 9, 4:44 pm, Adrian Lynch adely...@googlemail.com wrote: That's what I was hoping for, but next() and prev() act on the next and previous elements in the DOM, not in the nodes you're looping over. To demonstrate: $(p).each(function(i) { console.info($(this).next().html()); console.info($(this).prev().html()); }); form action=test.cfm method=post div p1/p div pThis is next/p /div /div div div pThis is previous/p /div p2/p /div div p3/p /div /form Maybe I have to come out to the outer most divs before calling next()/ prev() on it. Adrian On Feb 4, 4:16 pm, Stephan Veigl stephan.ve...@gmail.com wrote: Hi, there are prev() and next() functions doing exactly what you need: $(div).each( function() { var prev = $(this).prev(); var next = $(this).next(); alert( prev.text() + - + next.text() ); }); (I've skipped the extra code for the first and last element for simplicity.) by(e) Stephan 2009/2/4AdrianLynchadely...@googlemail.com: Hey all, I'm loop over some nodes witheach() and I need to look at the next and previous elements for the current iteration. script type=text/javascript $(function() { $(div).each(function(i) { var prev = [SELECTOR FOR PREVIOUS DIV].text(); var next = [SELECTOR FOR NEXT DIV].text(); alert(prev + : + next); }); }); /script div1/div div2/div div3/div Will I have to store a reference to the divs and access it with i in the loop like this: script type=text/javascript $(function() { var divs = $(div); divs.each(function(i) { var prev = ; var next = ; if (i 0) prev = $(divs.get(i - 1)).text(); if (i divs.size() - 1) next = $(divs.get(i + 1)).text(); alert(prev + - + next); }); }); /script div1/div spanSpanner in the works/span div2/div spanDon't select me!/span div3/div Is next() the answer maybe?
[jQuery] Initialize tabs href.
Hallo all. I would like to initialize the tabs href on the document.ready. http://pastie.org/384170 I tried like this http://pastie.org/384232 But it doesn't work. Any idea? Kind regards Massimo Ugues
[jQuery] Re: Passing a Index to a function
How COme we could not have access inside the BIND with THIS !! I'm Confused On Feb 9, 7:16 am, Pedram pedram...@gmail.com wrote: I check these two solutions it didn't work ... On Feb 8, 11:42 pm, RobG rg...@iinet.net.au wrote: On Feb 9, 4:54 pm, Pedram pedram...@gmail.com wrote: Dear folk, I want to get the index of the TR and send it to the Function , I don't know how to it . this is what I'm trying to do $(table tr).bind(click,{IndexName:$(this).index(this)},clickFunc) The DOM 2 HTML TR.rowIndex property should do the job. -- Rob
[jQuery] Re: jquery, OOP and this - Problem
Yea, the scope should be fine. You just have to wrap this in $() when using the reference to the element. On Feb 9, 2:09 pm, SoulRush saavedra@gmail.com wrote: Did you try with $(this).setContent(); instead of this.setContent(); ? On 9 feb, 14:13, Creativebyte michaelhaszpru...@googlemail.com wrote: Hello group, I got a problem with a JS class I am writing. I got the following piece of code: this.slide=function(){ $(this.container_selector_contents).fadeOut(1000, function(){ this.setContent(); this.fadeIn(1000) }); } The problem is, that inside the fadeOut() function this is now not the class but the jQuery element. So, how can I access my classes methods and variables again sine I can't use this? Thanks for your help!
[jQuery] Re: Optimize large DOM inserts
I used event delegation along with live() so it works on new elements and it got rid of the leak! Some good references for those who are interested: http://www.learningjquery.com/2008/03/working-with-events-part-1 http://lab.distilldesign.com/event-delegation/ I've also wrapped the content into a tbody before appending (as opposed to inserting into an existing tbody) and that shaved off a couple of ms also. Sweet! I'm learning more and more from this topic! On Feb 7, 8:35 am, Ricardo Tomasi ricardob...@gmail.com wrote: There's no need to use that function to insert the HTML, as the performance improvement comes mostly from emptying the element outside the DOM. To avoid the memory leak, you'd have to remove all the event listeners before destroying it - that's exactly what empty() does (+ clearing any data), and the source of most of it's overhead. You can probably get around that by not attaching any events to the inner elements and use event delegation on the table or live() instead. You might get away with something like this, not sure if it will perform any better: var c = $('#container')[0], parent = c.parentNode, next = c.nextSibling, old = parent.removeChild(c); c = old.cloneNode(false).innerHTML = out.join(''); if (next) next.insertBefore(c); else parent.appendChild(c); setTimeout(function(){ $(old).remove(); }, 200); //give the browser some breathing time then clean up eventsdata from the old element The cleaning up part will be unnecessary if you use event delegation. - ricardo On Feb 6, 9:17 pm, James james.gp@gmail.com wrote: I just noticed in IE6 that using the replaceHTML to clear the DOM with events attached definitely creates memory leak. FF seems to clean it up though. On Feb 6, 1:06 pm, James james.gp@gmail.com wrote: Wow! Wow! Wow! Using that replaceHTML function to empty out the element took practically no time at all! Though I wasn't able to get it to work properly in IE (tried only IE6) as oldEl.innerHTML = html; kept bombing on me with unknown runtime error. I've removed the IE-only part and let it run the rest. It's still many times faster than using $(el).empty(); However, I wasn't able to get replaceHTML to work on inserting HTML into the DOM though. Using the previous suggestions, it would become: replaceHtml('myElementID', out.join('')); but the inserted HTML in 'myElementID' had all of the HTML tags (tr, td, etc.) stripped out for some reason. On Feb 6, 11:48 am, Ricardo Tomasi ricardob...@gmail.com wrote: Now I might have something useful to say! :) I remember this being discussed long ago on the 'replaceHTML' subject. Apparently using .innerHTML on an element that is not in the DOM is much faster (except for IE which is already fast). See here: http://blog.stevenlevithan.com/archives/faster-than-innerhtmlhttp://w.. cheers, - ricardo On Feb 6, 6:28 pm, James james.gp@gmail.com wrote: Big thanks for the optimization! It certainly did optimize the loop processing by several folds! However, for my case, I found that the ultimate bottleneck was the plug-in function that I was using that froze the browser the longest. The actual insert to the DOM took a bit of time also and did freeze the browser, but wasn't too bad even in IE6. By the way, do you have any tips on emptying a large amount of content in the DOM? Such as emptying that whole chunk of HTML that was inserted. That also freezes the browser also. I'm currently using $(el).empty(); and not sure if there's a more optimal solution. Thanks! On Feb 5, 5:25 pm, Michael Geary m...@mg.to wrote: ...there is not much room for improvement left. You just know that when you say that, someone will come along with a 20x-40x improvement. ;-) http://mg.to/test/loop1.html http://mg.to/test/loop2.html Try them in IE, where the performance is the worst and matters the most. On my test machine, the first one runs about 6.3 seconds and the second one about 0.13 seconds. -Mike From: Ricardo Tomasi Concatenating into a string is already much faster than appending in each loop, there is not much room for improvement left. What you can do improve user experience though is split that into a recursive function over a setTimeout, so that the browser doesn't freeze and you can display a nice loading animation. On Feb 5, 5:03 pm, James james.gp@gmail.com wrote: I need tips on optimizing a large DOM insert to lessen the freeze on the browser. Scenario: I receive a large amount of JSON 'data' through AJAX from a database (sorted the way I want viewed), and loop through them to add to a JS string, and insert that chunk of string into
[jQuery] Re: Getting Style Information (left/top)
Be aware that style.top is not necessarily the position of an element. You can use $('TheDivInQuestion').position().top (and $ ('TheDivInQuestion').position().left) to find it's actual position. On Feb 9, 11:07 am, Michael Lawson mjlaw...@us.ibm.com wrote: If you look at the documentation for jQuery you'll see that many jQuery functions either return jQuery itself, or an array of elements. Your usage would return an array of the element in question so you might want to try something like this $(#TheDivInQuestion)[0].style.top Hope that helps! cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: Paul Hutson hutsonphu...@googlemail.com To: jQuery (English) jquery-en@googlegroups.com Date: 02/09/2009 02:02 PM Subject: [jQuery] Getting Style Information (left/top) Hello, I'm a(nother?) new person to Jquery and have found it to be *excellent* so far (when I say that I may be understating how damned awesome it is!!) There is only one thing that has been bothering me - I can't seem to find a way of finding a position of an item with an easy Jquery shortcut. i.e. to find out the style.top value of an element, I have to use the following : document.getElementById(TheDivInQuestion).style.top Am I missing something that does this with something like : $ (#TheDivInQuestion).top or $(#TheDivInQuestion).style.top :? (both of which don't work for me..) Thanks in advance, Paul Hutson graycol.gif 1KViewDownload ecblank.gif 1KViewDownload
[jQuery] Re: Safe Ajax Calls?
By the way, the first parameter takes the vars to send... so in the pages I've to dynamically set varname1=value1varname2=value2 On 9 feb, 10:40, SoulRush saavedra@gmail.com wrote: Hi! I'm kind of new at the world of ajax and jquery and i'm starting to make a site with them. In my site i've created a single function (in the header) called ajaxQry(...) which takes some parameters like, url to make post or get, if I need GEt or POST, the data type of the query, a success function and an error function. Anyway, it look like this: function ajaxQry(sendVars, url, returnType, backFunction, errorFunction){ $.ajax({ type: POST, url: ajax/+url+.asp?nocache=+Math.random(), data: sendVars, success: backFunction, //ussully this loads the content in the main page as html dataType: returnType, error: errorFunction }); } Everything works great but i don't know if there's a better way to do this, because in many events of the site I call this function... And I'm starting to think that it's pretty insecure What do you think? By the way i ussually call the url file (see the function) and return HTML content, and then i load it in the page with $(selector).html(); is that okay? Thanks! and sorry for my english :$
[jQuery] Access DOM cross-domain
I'm playing around with writing a server-side script that generates JSONP from content that is downloaded by the script (URL is passed to script from querystring). Is there a better way to do it than to encode it as base64, or is there a work-around that doesn't require any server-side code? I'm basically trying to get access to a given page's DOM cross-domain using minimal server-side code. I suppose one thing that would be needed here is a regex to replace non http src attributes. Here is what I have so far: //test.htm body div id=mydiv/div script src=jquery.js/script script src=jquery.base64.js/script script function callback(e){ alert(e.data); alert($.base64Decode(e.data)); $(#mydiv).html($.base64Decode(e.data)); } /script script src=test.aspx?url=www.wikipedia.org/script /body //test.aspx %@ Page Language=C# AutoEventWireup=true % %@ Import Namespace=System % %@ Import Namespace=System.IO % %@ Import Namespace=System.Net % %@ Import Namespace=System.Text % script runat=server void Page_Load( object sender, EventArgs e ){ string url = Request[url] ?? ; Response.Write(callback({data:\+EncodeTo64(Get(url))+\})); Response.End(); } string EncodeTo64(string toEncode){ byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes (toEncode); string returnValue = System.Convert.ToBase64String (toEncodeAsBytes); return returnValue; } string Get(string strURL){ WebRequest myWebRequest = WebRequest.Create(http://+strURL); WebResponse myWebResponse = myWebRequest.GetResponse(); Stream ReceiveStream = myWebResponse.GetResponseStream(); Encoding encode = System.Text.Encoding.GetEncoding(utf-8); StreamReader readStream = new StreamReader( ReceiveStream, encode ); return readStream.ReadToEnd(); } /script
[jQuery] Re: Getting Style Information (left/top)
You can use either the css method: if you want to know the height of $(#TheDivInQuestion) Then $(#TheDivInQuestion).css(height); If you need another attribute of the css just change de parameter of the css: $(#TheDivInQuestion).css(top); $ (#TheDivInQuestion).css(left); ... On 9 feb, 14:00, Paul Hutson hutsonphu...@googlemail.com wrote: Hello, I'm a(nother?) new person to Jquery and have found it to be *excellent* so far (when I say that I may be understating how damned awesome it is!!) There is only one thing that has been bothering me - I can't seem to find a way of finding a position of an item with an easy Jquery shortcut. i.e. to find out the style.top value of an element, I have to use the following : document.getElementById(TheDivInQuestion).style.top Am I missing something that does this with something like : $ (#TheDivInQuestion).top or $(#TheDivInQuestion).style.top :? (both of which don't work for me..) Thanks in advance, Paul Hutson
[jQuery] jQuery not loading?
Am using the Cycle plugin, and linking to the Google jQuery library (have also tried linking to site version). jQuery effect doesn't seem to be loading for anyone but me (definitely not Browsershots, and apparently not client). http://www.horseink.com/chdrsg/start.html I'd be grateful for any ideas. Another stupid question, I'm sure, but am stumped at this point. Wendy
[jQuery] expanding menu
I have a simple expanding menu at http://www.compassion-in-business.co.uk/virgo/manual/contents.htm I'm wondering if (a) I can make this work with a mouseover event rather than click; and (b) when opening one subsection I can get it to close the open one(s). Many thanks
[jQuery] expanding menu
Hi - I hope this doesn't appear twice. I posted it over half-an-hour ago and it didn't show. I have a simple expanding menu at http://www.compassion-in-business.co.uk/virgo/manual/contents.htm I'm wondering if (a) I can make this work with a mouseover event rather than click; and (b) when opening one subsection I can get it to close the open one(s). Many thanks
[jQuery] Re: alignment IN IE6 ... with jquery..
Hi, I see the menu on top on both FF and IE and a box overlaying the menu if the mouse enters the image on the left. screenshot: http://www.iaeste.at/~stephan/test/chillenvillen.jpg by(e) Stephan 2009/2/8 shyhockey...@gmail.com shyhockey...@gmail.com: did you go to the home button??? and type username TEST all caps for both the user name and password? in the account I use jquery for the javascript. when you look at the page in IE7 and IE6 you will see the menu and other stuff all positioned in weird places and the menu is shown in a random place no fade in nor fade out. I couldn't see the screen shot you gave. I saw a error message in german or something. On Feb 6, 4:21 pm, Stephan Veigl stephan.ve...@gmail.com wrote: I've taken an additional look at your HTML CSS and it seems like you are positioning all your images absolute with left top position, so I don't see what should be different on IE. by(e) Stephan 2009/2/6 Stephan Veigl stephan.ve...@gmail.com: Hi I've tested the page and it looks similar in FF3 and IE7 for me. Here is a screenshot (http://www.bilderbeutel.de/pic_call_hires.php?tab=pic_upid=11), I'm not sure if this is how it should look like. by(e) Stephan 2009/2/6 shyhockey...@gmail.com shyhockey...@gmail.com: OK, My website is : www.chillenvillen.com on that site click the home button. It will take you to a login page use TEST for both user name and password. this takes you to a test account. This account page has jquery javascript. Use Firefox to see what it supposed to be doing and then look at it with IE7 or 6 and you will see what I am complaining about. hope this helps any. On Feb 5, 4:15 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi, can you post your code (e.g. at jsbin.com) or give us a link to it. Being standard compliant is always a good idea :-) by(e) Stephan 2009/2/5 shyhockey...@gmail.com shyhockey...@gmail.com: Hi, ok currently I just looked at my website using IE6 and IE7. I notice the pages I used jquery and javascript, would be randomly placed around the website and also the menus that needed to fade in and out when a mouse hover occurs over the user image. Well those menus show up as images and dosen't fade in or out but is randomly placed around the website. In firefox it works fine. I can see it fade in and out and many other stuff. So firefox is set to go. it's just that IE 7, and 6 is weird. It would randomly place the elements around the website. It would also show hidden elements meaning that they are hidden first and then fade in upon a certain condition. So is there anyway I can fix this??? I heard that I need to comply with WS3 . I heard their is a standard that I need to follow in order for my javascript or jquery to show properly. Any ideas?
[jQuery] Re: Accordion newbie problem
Assuming you use the default header: a, add this: $(#accordion).accordion({ active: a:last }); Jörn On Mon, Feb 9, 2009 at 7:41 PM, oobov mr.oo...@gmail.com wrote: Hi there. I don't know if it is the right place for that, sorry if not. I have a newbie problem. I've red the documentation but i can't find the solution. I have a page with 3 accordions, based on the demo script, so i have: jQuery().ready(function(){ // simple accordion jQuery('#list1a').accordion({ animated: easeslide, autoheight: true }); jQuery('#list1b').accordion({ animated: easeslide, autoheight: true }); jQuery('#list1c').accordion({ animated: easeslide, autoheight: true }); }); By default, the first element of each accordions is the one open. All i would like to do is to make the LAST one open at the beggining. Thanx for your time.
[jQuery] Re: jQuery not loading?
Seems to work and load just fine for me here Firebug shows all files as loaded and i see the Cycle plugin doing it's thing have you tried using the Net panel of Firebug (if you're using Firefox) or using Fiddler if you're in IE to see what your computer is seeing/doing? On Feb 9, 3:20 pm, Wendy wendy.storage.2...@gmail.com wrote: Am using the Cycle plugin, and linking to the Google jQuery library (have also tried linking to site version). jQuery effect doesn't seem to be loading for anyone but me (definitely not Browsershots, and apparently not client). http://www.horseink.com/chdrsg/start.html I'd be grateful for any ideas. Another stupid question, I'm sure, but am stumped at this point. Wendy