[jQuery] Not able to jqGrid and jquery lightbox plugin in a single page
Hi, I am not able to use jqGrid and jquery lightbox plugin in a single page. Its shows an error i.e. Lightbox was not able to find it's javascript script tag necessary for auto-inclusion. What does it mean ? Can someone help me ? Thanks Devesh M
[jQuery] Re: Creating custom attributes in html
I see a lot of string concatenations. Use this instead. var str=[]; for(var i=0; i200; i++) str.push('table id=a_'+ i + '/table'); $(str.join('')).appendTo('div'); Also, from a performance standpoint, it's much faster to use W3c DOM methods to create nodes than using the innerHTML method to create nodes in newer js engines like v8. You might want to consider a browser detection to do the correct thing. On Apr 14, 10:56 am, seasoup seas...@gmail.com wrote: I was wondering what jquery developers opinion of adding custom attributes to html tags is, and what your basis is for these opinions? Why is it a good idea, or why is it a bad idea? What I mean is this: div href= myType=foocontent/div where 'myType' isn't in any specifications. I've run into developers who think this is a good idea, and those who think this is a bad idea and I'd like to get a better sense of both sides of the argument. Personally, I use them all of the time. They are a great way to preserve information for use with .live() in jQuery, among other things, and since I append a long string to the DOM instead of creating lots of little DOM nodes, I generally cannot use .data() to save information on the individual nodes. Example of a usage: div name=foo myType=barclick/div ... $('div[name=foo]').live('click', function () { console.log($(this).attr('myType')); }); Example of why I cannot use .data(): var htmlString = 'table'; for (var a = 0; a 100; a++) { htmlString += 'trtd name=clickme nodeId=filter'+ a +'click/td/tr';} htmlString += '/table'; $('div[name=foo]').append(htmlString); $('td[name=clickme]').live('click', function() { console.log($(this).attr('nodeId')); }); To debate the merits of using this kind of append, please go to:http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-cor... What I'm looking for instead is a discussion of using custom attributes in html. Thanks, Josh Powell
[jQuery] Re: Form validation plugin
The current validation plugin works fine with both 1.2.6 and 1.3.2. Jörn On Thu, Apr 16, 2009 at 1:48 AM, koolkat merrill.ma...@yahoo.com wrote: I have been using the form validation plugin with jquery 1.2.6. I would like to use the new jquery version 1.3.2 but was wondering if there is a replacement validation plugin for this version or if it could be made to work. Thank you.
[jQuery] Re: Help with cross-site form validation?
Writing a custom remote method requires much more then that. Please take a look at the source of the default remote - either try to replicate that, or better yet, try to use it as is. It passes through any parameters to $.ajax: remote: { url: ..., typo: post, // other $.ajax options } Jörn On Thu, Apr 16, 2009 at 12:11 AM, Trevor Rosen trevor.ro...@gmail.com wrote: I need to do validation on an email address via AJAX, and it has to happen cross-domain. I can get this to work fine using just jQuery's $.ajax method, but not when I try to turn it into a validator plugin method. As a validator method, it does the XHR call fine, and I see the results I expect in the console, but it seems to flag everything as invalid. The method is here: http://pastie.org/447779 I think I'm just bad at writing custom validation methods, b/c as I said up top this works fine as a regular jQuery function. Notice that I'm using the success callback to cheat a little -- my server-side code throws back a status code of 200 and a piece of JSON containing a string of either success or failure, and then the valid/invalid logic is in the success callback. I had to do this b/c the success callback is apparently the only one you get when doing a JSONP dataType. I'd love to use the great features inherent in the validator plugin for this if I could. Does anyone know how this can be done? many thanks! -TR
[jQuery] Re: question about dealing with JSON callback
On Apr 15, 7:33 pm, sneaks deroacheee...@gmail.com wrote: for anyone having similar problem heres how i resolved it: function getProductInfo(product_id) { jQuery.post( /wp/wp-admin/admin-ajax.php, { action: getProductInfo, 'cookie': encodeURIComponent(document.cookie), 'product_id': product_id },function(json) { var obj=eval('('+json+')'); jQuery.each(obj, function(i, val) { jQuery('#'+i).attr('value',val); }); },JSON); } Posting up relative paths to your PHP file does not help debug the problem. the key is you need string brackets around the string json for the eval Javascript has no such thing String Brackets. good luck Both guesswork and luck should be required to debug your problem from this perspective. But the problem is not that involved. Your dataType is is JSON not json[1]. The example jquery code you provided expects your document to have an element with ID for each property name in the JSON response. You should have provided a complete example. j Garrett [1]http://docs.jquery.com/Ajax/jQuery.post#urldatacallbacktype
[jQuery] Re: question about dealing with JSON callback
Just an FYI, but there's no 'object side' of the json in your example. It just an object, consisting of name-value pairs. While you can leave quotes off of the names, they are strings which, according to the RFC, should be quoted. Doing so will not cause problems, and will save you from potentially running into a situation where your name conflicts with one of the excessive number of reserved words. On Apr 15, 7:05 pm, sneaks deroacheee...@gmail.com wrote: the way i see it, there are quotes on the object side of the json where there should be no quotes...
[jQuery] how to select elements inside jQuery objects
i've tried to do the following on a grand scale the last few days, please help my suggestion to select a classname inside a object containing the xhtml $( mol_elements .mol_row ).append( td+ molname +/td); I was then suggested the following, but that selects BOTH class and element, right? $( .mol_row, mol_elements ).append( td+ molname +/td); how to select the classname inside the object then? /pär
[jQuery] show the number of insert record php jquery
Hi All can u tell , how to show the record inserting count at the time of insert process , Using PHP,JQUERY thanks -- உங்கள் நண்பன் பரணி குமார் Regards B.S.Bharanikumar POST YOUR OPINION http://bharanikumariyerphp.site88.net/bharanikumar/
[jQuery] Re: show the number of insert record php jquery
is it the autoincrement value that you are after? php.net says - mysql_insert_id /pär On 16 Apr, 10:52, bharani kumar bharanikumariyer...@gmail.com wrote: Hi All can u tell , how to show the record inserting count at the time of insert process , Using PHP,JQUERY thanks -- உங்கள் நண்பன் பரணி குமார் Regards B.S.Bharanikumar POST YOUR OPINIONhttp://bharanikumariyerphp.site88.net/bharanikumar/
[jQuery] [tablesorter] sortEnd never trigerred for sortDisabled columns
Hi, using tablesorter 2.0.3, when you click on the header of a column that has been disabled with the headers options the sortStart event is triggered but not the sortEnd. If you show a message on sortStart and hide it in sortEnd, the message is not hidden. Is it normal behaviour (as no sorting append)? should sortEnd be triggered? should sortStart not be triggered in this case? For the moment I added the following lines after line 581 : } else { // trigger sortend $this.trigger(sortEnd); Regards, Simon
[jQuery] Re: Creating custom attributes in html
@all - So far, the only reasons I've heard not to add custom attributes are 1) Dogma, 2) May cause quirks mode. In my mind, the benefits gained by using custom attributes: less code, simplicity, and clarity, far outweigh these two reasons not to do it. @Jack K - Thanks for the links :). I will consider adding 'data-' to future custom attributes. But, I actually don't really care if my html code is a valid document. Being a valid document has no practical meaning, all browsers render it just fine regardless of if it is valid or not. @RobG - I was being careless with my use of the words 'attribute' and 'properties', but did you really need to correct me 4 times, and then correct my use of override to overload twice? I guess you did. The class attribute might not have the words 'presentation' and 'style' in the W3C definition, but if you tell me that the class attribute is not meant primarily for styling DOM elements, I'm just going to ignore everything else you say as you are just being argumentative. So you've already got the data in an object, now you added it as custom HTML attributes, then suck it back out again using attr(). Can you see the silliness inherent in the system? Actually, I think it is less silly then appending an id onto the end of the attribute id and then parsing it to obtain the id of the object I'm looking for, and then creating a custom object with get/set methods to retrieve the appropriate object to get its properties. Why not make the media object a bit smarter than just an array, say with set and get methods? Because that is unnecessary code. It's code I do not need to write if I just add custom attributes. @Kean - http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-correctly To sum up: - string concatenation is plenty fast 99% of the time and a lot more readable. - W3C DOM Node creation is much slower then inserting via innerHTML, especially as you add more nodes. It doesn't matter how fast the nodes are created, it will always be slower to create, adjust, and insert 10,000 nodes then one string.
[jQuery] jQuery.post() not working for me
Hi, I'm trying to use jQuery.post() function to retrieve som data. But i get no ouput. My PHP file looks like this: ?php inlcude_once('dal.php'); //Get store data, and ouput it as JSON. function getStoreInformation($storeID) { $sl = new storeLocator(); $result = $sl-getStoreData($storeID); while ($row = mysqli_fetch_assoc($result)) { { $arr[] = $row; } $storeData = json_encode($arr); echo $storeData; //Output JSON data } ? This is my javascript which is located in /js/myscripts.js jQuery(document).ready(function() { jQuery('#storeListTable tr').click(function() { jQuery.post(../functions.php, { func: getStoreInformation }, function(data){ alert(data.name); // To test if I get any output //$('#store_name').val(data.name); // I could do this to populate my form //$(#store_data_form).populate(data, {debug:1}) //But I probably will use jQuery Populate plugin instead }, json); }); }); If this is working, I should be able to get an alert message, right?
[jQuery] Receiving Error - But functionality remains! - Strange!
Hey, I'm receiving the following error: Error: uncaught exception: Syntax error, unrecognized expression: # However all the functionality of the script continues to work, I need to get rid of the error as it looks pretty bad on client's sites and want to make sure the script isnt doing anything funny. The basic set up is a number of Select boxes, When selecting an option in the select boxes, I loop through a JSON stock array to see if the item is in stock and to then enable / disable the relevant options in the other selects based on the stock record. The error (as far as I can see) appears on this line: $(#option + nextid + option).filter(function(){ return($(this).attr('id') ==stockitem); }).enable(); but it seems to work fine. The following script is on the change event of the selects: // Get the next Select's id var thisorder = $(this).attr('rel').substr(0,$ (this).attr('rel').indexOf('|')); var next = $(this); $('.productOptions').find('select').each(function(){ if( $(this).attr('rel').substr(0,$(this).attr ('rel').indexOf('|')) == (parseInt(thisorder) + 1)) { next = $(this); } if ($(this).attr('rel').substr(0,$(this).attr ('rel').indexOf('|')) thisorder){ $(this).disableSel(); $(this).find('option:first').attr ('selected', 'selected').parent('select'); } }); var nextid = $(next).attr('id').replace ('option',''); // If not chosen the [Choose] option.. if($(this).children('[selected=true]').val()){ // Disable all the items in the next select apart from [choose/none] $(next).children('option[value!=]').disable(); // Check each of the stock records for(i=0; idata.stock.count; i++){ // For each of the selects get the option id and item id $('.productOptions').find('select [disabled=false]').each(function(){ var optionid = $(this).attr ('id').replace('option',''); var itemid = $(this).children ('[selected=true]').attr('id'); curritemid = data.stock[i].items [optionid]; if(curritemid != itemid){ qty = 0; stockitem = 0; return false; }else{ stockitem = data.stock[i].items [nextid]; qty = data.stock[i].qty; } }); if (stockitem!==0) { // Enable the item based on the current stock record, and the next selects id $(#option + nextid + option).filter(function(){ return($(this).attr('id') ==stockitem); }).enable(); } } $(next).enableSel(); }
[jQuery] Re: show the number of insert record php jquery
Hi harbris , I want something like , user want to know till how records inserted , like in the page view , we have to show till 10 records inserted , after some time till 15 records inserted , like that progress process am looking ,,jqu -- உங்கள் நண்பன் பரணி குமார் Regards B.S.Bharanikumar POST YOUR OPINION http://bharanikumariyerphp.site88.net/bharanikumar/
[jQuery] JQuery.isReady property
JQuery.isReady is NOT documented, but I have a valid use case for it and was wondering if there is a documented way of doing the same thing. I have a case where some code could be loaded as the page loads, but I don't have a particular function to fire until the document isReady. The same code could also be loaded in a context after the page loads (Injected into the dom) if (JQuery.isReady) { //Call function explicitly } else { //Call function on document.ready() }
[jQuery] Re: Selecting radio buttons within different RadioGroups via a click
OK - I have the solution so I figured I'd post it to help anyone else looking for the same solution. If you can make it cleaner/better, please post! script $(document).ready(function(){ $(#button1).click(function(){ $(input:radio[name='RadioGroup1']:nth(0)).attr(checked,checked); $(input:radio[name='RadioGroup2']:nth(1)).attr(checked,checked); }); $(#button2).click(function(){ $(input:radio[name='RadioGroup1']:nth(1)).attr(checked,checked); $(input:radio[name='RadioGroup2']:nth(2)).attr(checked,checked); }); }); /script On Apr 15, 7:31 pm, madrid440-goo...@yahoo.co.uk madrid440- goo...@yahoo.co.uk wrote: I should have added some clearer HTML. I've added tables to break it up a bit: input type=submit name=button1 id=button1 value=Selection1 / input type=submit name=button2 id=button2 value=Selection2 / table tr td labelinput type=radio name=RadioGroup1 value=0 id=RadioGroup1_0 /0/label labelinput type=radio name=RadioGroup1 value=1 id=RadioGroup1_1 /1/label labelinput type=radio name=RadioGroup1 value=2 id=RadioGroup1_2 /2/label/td /tr /table table tr td labelinput type=radio name=RadioGroup2 value=0 id=RadioGroup2_0 /0/label labelinput type=radio name=RadioGroup2 value=1 id=RadioGroup2_1 /1/label labelinput type=radio name=RadioGroup2 value=2 id=RadioGroup2_2 /2/label /td /tr /table On Apr 15, 2:08 am, madrid440-goo...@yahoo.co.uk madrid440- goo...@yahoo.co.uk wrote: I'm getting lost in selectors... I am trying to achieve the following: A button click needs to select certainradiobuttons within different radiogroups. e.g RadioGroup1_0 and RadioGroup2_1 A click on another button resets theradiobuttons to blank, and then selects differentradiobuttons within thoseradiogroups. e.g. RadioGroup1_1 and RadioGroup2_2 input type=submit name=button1 id=button1 value=Selection1 / input type=submit name=button2 id=button2 value=Selection2 / labelinput type=radio name=RadioGroup1 value=0 id=RadioGroup1_0 /0/label labelinput type=radio name=RadioGroup1 value=1 id=RadioGroup1_1 /1/label labelinput type=radio name=RadioGroup1 value=2 id=RadioGroup1_2 /2/label labelinput type=radio name=RadioGroup2 value=0 id=RadioGroup2_0 /0/label labelinput type=radio name=RadioGroup2 value=1 id=RadioGroup2_1 /1/label labelinput type=radio name=RadioGroup2 value=2 id=RadioGroup2_2 /2/label
[jQuery] Re: how to select elements inside jQuery objects
I don't really understand what you want to do... Do you want to select a DOM-Object like form class=example ? Then, the selector would be $(form.example). Josch On 16 Apr., 10:47, hybris77 dist...@yahoo.com wrote: i've tried to do the following on a grand scale the last few days, please help my suggestion to select a classname inside a object containing the xhtml $( mol_elements .mol_row ).append( td+ molname +/td); I was then suggested the following, but that selects BOTH class and element, right? $( .mol_row, mol_elements ).append( td+ molname +/td); how to select the classname inside the object then? /pär
[jQuery] Re: Data() method, just changing value of one hash element
On Wed, Apr 15, 2009 at 1:50 AM, Dhana sldh...@gmail.com wrote: I am using the jQuery Data method to store data for dynamically created elements. Everything works fine until I try to update the value of an attribute. This is how I first create the element. $j.data(item, 'attributes', { Name: name, UOM: uom, WarehouseKey: orderItem.WarehouseKey, OriginalPrice: orderItem.OriginalPrice, ReqDate: dsOrder.cleanupResults(orderItem.ReqDate), WarehouseItemKey: orderItem.WarehouseItemKey, AvailableQty: orderItem.AvailableQty, BOQty: orderItem.BOQty, Notes: dsOrder.cleanupResults(orderItem.Notes), Cost: orderItem.Cost, GP: dsOrder.cleanupResults(orderItem.GP), Description: dsOrder.cleanupResults (orderItem.description) }); At a later point based on a user's interaction, the required date, note, and warehouse key gets updated. This is the first way I tried updating it, it doesn't store the value. $j(item, 'attributes.ReqDate', $j('#section_item #requiredDate').attr ('value')); This doesn't work because the text after the dot (.) is the namespace of the data attribute. Then I tried it like this $j.data(item, 'attributes', { 'WarehouseKey': $j('#%=ItemWarehouseList.ClientId %').val() }); This overwrited all the other data stored in 'attributes'. Only WarehouseKey is then saved. Is there a way to change just one value without affecting the rest of the data? Grab the hash, modify the value, then put it back: var attr = $j.data(item, 'attributes'); attr.WarehouseKey = $j('#%=ItemWarehouseList.ClientId%').val(); $j.data(item, 'attributes', attr); - Richard
[jQuery] Re: jQuery.post() not working for me
Do you get an empty alert or nothing? On 16 Apr., 12:13, spstieng spsti...@hotmail.com wrote: Hi, I'm trying to use jQuery.post() function to retrieve som data. But i get no ouput. My PHP file looks like this: ?php inlcude_once('dal.php'); //Get store data, and ouput it as JSON. function getStoreInformation($storeID) { $sl = new storeLocator(); $result = $sl-getStoreData($storeID); while ($row = mysqli_fetch_assoc($result)) { { $arr[] = $row; } $storeData = json_encode($arr); echo $storeData; //Output JSON data } ? This is my javascript which is located in /js/myscripts.js jQuery(document).ready(function() { jQuery('#storeListTable tr').click(function() { jQuery.post(../functions.php, { func: getStoreInformation }, function(data){ alert(data.name); // To test if I get any output //$('#store_name').val(data.name); // I could do this to populate my form //$(#store_data_form).populate(data, {debug:1}) //But I probably will use jQuery Populate plugin instead }, json); }); }); If this is working, I should be able to get an alert message, right?
[jQuery] Re: show the number of insert record php jquery
not sure what you are after, is it a paging function? or plainly displaying the latest inserts? On 16 Apr, 11:21, bharani kumar bharanikumariyer...@gmail.com wrote: Hi harbris , I want something like , user want to know till how records inserted , like in the page view , we have to show till 10 records inserted , after some time till 15 records inserted , like that progress process am looking ,,jqu -- உங்கள் நண்பன் பரணி குமார் Regards B.S.Bharanikumar POST YOUR OPINIONhttp://bharanikumariyerphp.site88.net/bharanikumar/
[jQuery] Re: how to select elements inside jQuery objects
Try this: $(mol_elements).filter(.mol_row).append( td+ molname +/td); On Thu, Apr 16, 2009 at 09:08, Josch jluelsd...@googlemail.com wrote: I don't really understand what you want to do... Do you want to select a DOM-Object like form class=example ? Then, the selector would be $(form.example). Josch On 16 Apr., 10:47, hybris77 dist...@yahoo.com wrote: i've tried to do the following on a grand scale the last few days, please help my suggestion to select a classname inside a object containing the xhtml $( mol_elements .mol_row ).append( td+ molname +/td); I was then suggested the following, but that selects BOTH class and element, right? $( .mol_row, mol_elements ).append( td+ molname +/td); how to select the classname inside the object then? /pär
[jQuery] Re: jQuery.post() not working for me
No, I don't get alert. That means it's failing silently. I've tested the functions.php (by running it) and it ouputs the data in JSON format. So retrieveing and echo'ing the data works fine. It's the jQuery that I got wrong. 1. How do I call a specific funtion within functions.php? I got a bad feeling that func: getStoreInformation is just an input parameter and has nothing to do with calling the function getSToreInformation(). 2. I need to pass the storeID. I get this with the folloing line: var storeID = this.cells[0].innerHTML;. I guess I should pass it as parameter: jQuery.post(../ functions.php, { func: getStoreInformation, sID: storeID } But I don't think I can use sID: storeID . Steven On 16 Apr, 14:13, Josch jluelsd...@googlemail.com wrote: Do you get an empty alert or nothing? On 16 Apr., 12:13, spstieng spsti...@hotmail.com wrote: Hi, I'm trying to use jQuery.post() function to retrieve som data. But i get no ouput. My PHP file looks like this: ?php inlcude_once('dal.php'); //Get store data, and ouput it as JSON. function getStoreInformation($storeID) { $sl = new storeLocator(); $result = $sl-getStoreData($storeID); while ($row = mysqli_fetch_assoc($result)) { { $arr[] = $row; } $storeData = json_encode($arr); echo $storeData; //Output JSON data } ? This is my javascript which is located in /js/myscripts.js jQuery(document).ready(function() { jQuery('#storeListTable tr').click(function() { jQuery.post(../functions.php, { func: getStoreInformation }, function(data){ alert(data.name); // To test if I get any output //$('#store_name').val(data.name); // I could do this to populate my form //$(#store_data_form).populate(data, {debug:1}) //But I probably will use jQuery Populate plugin instead }, json); }); }); If this is working, I should be able to get an alert message, right?
[jQuery] Re: Creating custom attributes in html
On Apr 16, 7:53 pm, Josh Powell seas...@gmail.com wrote: @all - So far, the only reasons I've heard not to add custom attributes are 1) Dogma, Dogma: a religious doctrine that is proclaimed as true without proof URL: http://www.google.com/search?hl=enclient=safarirls=endefl=enq=define:dogmaei=AQ3nSbejKMaGkQXAtfyeBwsa=Xoi=glossary_definitionct=title You were given good reasons. If they aren't sufficient for you, fine, but don't dismiss them out of hand. 2) May cause quirks mode. And are not necessarily consistent across browsers. In my mind, the benefits gained by using custom attributes: less code, simplicity, and clarity, far outweigh these two reasons not to do it. Fine, all bets are off. [...] @RobG - I was being careless with my use of the words 'attribute' and 'properties', but did you really need to correct me 4 times, and then correct my use of override to overload twice? I guess you did. It's pretty common to confuse the two - in a technical group, accuracy of terminology matters. You didn't appear to know what an expando was initially, I think you know what it is now. The class attribute might not have the words 'presentation' and 'style' in the W3C definition, but if you tell me that the class attribute is not meant primarily for styling DOM elements, I'm just going to ignore everything else you say as you are just being argumentative. You asked for comment, you got it. I presented proof that it is not meant *only* for presentation. If that's all you want to use it for, fine, but your inference that it should be reserved just for presentation is not substantiated by the W3C HTML specification. Your assertion in the OP that ...I append a long string to the DOM instead of creating lots of little DOM nodes... is not necessarily true. You don't need to make any additional DOM nodes or objects, or even additional native objects. You make the same number of elements and use the data in the object that already holds it. Seems to me that is less effort and leaves the data where it belongs from an architectural perspective. So you've already got the data in an object, now you added it as custom HTML attributes, then suck it back out again using attr(). Can you see the silliness inherent in the system? Actually, I think it is less silly then appending an id onto the end of the attribute id and then parsing it to obtain the id of the object I'm looking for, and then creating a custom object with get/set methods to retrieve the appropriate object to get its properties. That's not what I suggested. I said to leave the data in the object and use the ID as a key to get it. All you need to do is add an ID that is the same as the key, there is no need to put any data into custom attributes or expandos. There is quite a bit of synergy between document property names and DOM element IDs. Why not make the media object a bit smarter than just an array, say with set and get methods? Because that is unnecessary code. It's code I do not need to write if I just add custom attributes. You can either write custom code to get the attributes (as you've done) or you can write a single getter to get property values from an object (perhaps a one line function). I'd say it's pretty even as far as coding effort is concerned, the object approach has the benefit of not being constrained by the vagaries of adding custom properties and trying to read them. @Kean -http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-cor... To sum up: - string concatenation is plenty fast 99% of the time and a lot more readable. - W3C DOM Node creation is much slower then inserting via innerHTML, especially as you add more nodes. It doesn't matter how fast the nodes are created, it will always be slower to create, adjust, and insert 10,000 nodes then one string. Not necessarily so - in Safari 4 on MAC OS, DOM is faster than innerHTML. A 1GHz G4 iBook (a great test platform for web applications) can insert 10,000 spans in 15ms using DOM, or 25ms using innerHTML. The same code and machine with Firefox was: innerHTML 200ms, DOM 300ms. An iPhone did innerHTML 249, DOM 463, so it isn't as clear cut as you think. Are you really adding 10,000 elements to a page? Besides, how you generate the DOM is a different issue to how you store your data on the client. -- Rob
[jQuery] Re: Selector questions
Thanks, Karl. Your suggestions work fine. I just started using JQuery and found the selectors very powerful. I was wondering if the selectors that you suggested can be less dependent on the number of divs in that section of the HTML. Instead of using $(this).parent().parent().find(':checkbox'), is there a way to select using the following rule: Go up the hierarchy (regardless of how many parents there are) until the first a is found, then give me a list of all the checkboxes that are the descendants of the div right after the a. Similarly, instead of using $(this).parent().parent().prev(), is there a way to select using the following rule: Go up the hierarchy (regardless of how many parents there are) and return the first a. The reason that I asked these questions is because I can see myself adding more div's in that section of the HTML. On Apr 15, 10:31 pm, Karl Swedberg k...@englishrules.com wrote: On Apr 15, 2009, at 6:24 PM, Dragon-Fly999 wrote: Hi, I have a couple of questions about selectors. I have the following HTML: = Some a elements and input elements here. ... ... a id=info-1-headingInformation Type 1/a div div input class=cat id=first type=checkbox/label for=firstFirst/label /div div input class=cat id=mid type=checkbox/label for=midMiddle/label /div div input class=info1-cat id=last type=checkbox/label for=lastLast/label /div /div ... ... More a elements and input elements here. = Question 1: In the click handler of the first checkbox, I would like to get the first, middle, and last checkboxes (but not the other checkboxes on the page). What selector should I use? There are a number of options, but this will do the trick: $(this).parent().parent().find(':checkbox') Question 2: In the click handler of the first checkbox, I would like to get the first a element that it finds traversing up the hierarchy (i.e. the a with id=info-1-heading). What selector should I use? Thank you. $(this).parent().parent().prev() or combined: $ (this ).parent ().parent ().find(':checkbox').doSomething().end().prev().doSomethingElse(); and a bit more readable: $(this) .parent() .parent() .find(':checkbox').doSomething() .end() .prev().doSomethingElse(); --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com
[jQuery] how can I delete all elements: children and parent
I have: span id='57' bla bla bla br/ a href='#' something1 /abr/ a href='#' onclick='clickk(57); return false;' DELETE /a br/br/ /span How can I delete span element with id=57 and also everything inside ?
[jQuery] Re: Selector questions
Maybe is easier if you put a class (wrapper) in your div that wrap all other divs, and then you could use: $(this).closest('div.wrapper').find(:checkbox); and $(this).closest('div.wrapper').prev(); On Thu, Apr 16, 2009 at 09:26, Dragon-Fly999 dragon-fly...@hotmail.comwrote: Thanks, Karl. Your suggestions work fine. I just started using JQuery and found the selectors very powerful. I was wondering if the selectors that you suggested can be less dependent on the number of divs in that section of the HTML. Instead of using $(this).parent().parent().find(':checkbox'), is there a way to select using the following rule: Go up the hierarchy (regardless of how many parents there are) until the first a is found, then give me a list of all the checkboxes that are the descendants of the div right after the a. Similarly, instead of using $(this).parent().parent().prev(), is there a way to select using the following rule: Go up the hierarchy (regardless of how many parents there are) and return the first a. The reason that I asked these questions is because I can see myself adding more div's in that section of the HTML. On Apr 15, 10:31 pm, Karl Swedberg k...@englishrules.com wrote: On Apr 15, 2009, at 6:24 PM, Dragon-Fly999 wrote: Hi, I have a couple of questions about selectors. I have the following HTML: = Some a elements and input elements here. ... ... a id=info-1-headingInformation Type 1/a div div input class=cat id=first type=checkbox/label for=firstFirst/label /div div input class=cat id=mid type=checkbox/label for=midMiddle/label /div div input class=info1-cat id=last type=checkbox/label for=lastLast/label /div /div ... ... More a elements and input elements here. = Question 1: In the click handler of the first checkbox, I would like to get the first, middle, and last checkboxes (but not the other checkboxes on the page). What selector should I use? There are a number of options, but this will do the trick: $(this).parent().parent().find(':checkbox') Question 2: In the click handler of the first checkbox, I would like to get the first a element that it finds traversing up the hierarchy (i.e. the a with id=info-1-heading). What selector should I use? Thank you. $(this).parent().parent().prev() or combined: $ (this ).parent ().parent ().find(':checkbox').doSomething().end().prev().doSomethingElse(); and a bit more readable: $(this) .parent() .parent() .find(':checkbox').doSomething() .end() .prev().doSomethingElse(); --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com
[jQuery] Re: jQuery.post() not working for me
1. Some questions :-) The click-Handler works? The post is triggered? 2. You can't call a function just with func: getStoreInformation. You could use your func: getStoreInformation on Javascript, but then you have to do something like $func = $_POST['func']; $storeID = $_POST['sID']; call_user_func ($func, $storeID); // Not sure about the syntax here, but something like that ..because func is just another parameter for PHP. 3. Yes, you can use sID: storeID Greets, Josch On 16 Apr., 14:21, spstieng spsti...@hotmail.com wrote: No, I don't get alert. That means it's failing silently. I've tested the functions.php (by running it) and it ouputs the data in JSON format. So retrieveing and echo'ing the data works fine. It's the jQuery that I got wrong. 1. How do I call a specific funtion within functions.php? I got a bad feeling that func: getStoreInformation is just an input parameter and has nothing to do with calling the function getSToreInformation(). 2. I need to pass the storeID. I get this with the folloing line: var storeID = this.cells[0].innerHTML;. I guess I should pass it as parameter: jQuery.post(../ functions.php, { func: getStoreInformation, sID: storeID } But I don't think I can use sID: storeID . Steven On 16 Apr, 14:13, Josch jluelsd...@googlemail.com wrote: Do you get an empty alert or nothing? On 16 Apr., 12:13, spstieng spsti...@hotmail.com wrote: Hi, I'm trying to use jQuery.post() function to retrieve som data. But i get no ouput. My PHP file looks like this: ?php inlcude_once('dal.php'); //Get store data, and ouput it as JSON. function getStoreInformation($storeID) { $sl = new storeLocator(); $result = $sl-getStoreData($storeID); while ($row = mysqli_fetch_assoc($result)) { { $arr[] = $row; } $storeData = json_encode($arr); echo $storeData; //Output JSON data } ? This is my javascript which is located in /js/myscripts.js jQuery(document).ready(function() { jQuery('#storeListTable tr').click(function() { jQuery.post(../functions.php, { func: getStoreInformation }, function(data){ alert(data.name); // To test if I get any output //$('#store_name').val(data.name); // I could do this to populate my form //$(#store_data_form).populate(data, {debug:1}) //But I probably will use jQuery Populate plugin instead }, json); }); }); If this is working, I should be able to get an alert message, right?
[jQuery] How to rotate image (in degrees)?
Is there a jquery plugin that will allow an image to be rotated by say 90 - 180 degrees? I'm using it in my background (multiple times) and I want it to appear in different places and rotated so it doesn't appear to be the same image. TIA
[jQuery] Complete noob needs help setting up jquery in windows XP
I am an amatuer website creator and like to use the most accepted and best methods of developing on a site. I learned how CSS simplified how HTML looks and now I've been reading about how jQuery simplifies how HTML acts with javascript. Right away I ran into a wall. I am using Windows XP and Microsoft Expression Web 2 to create my site. I cannot figure out how to build, make, unpack jQuery. I'm not exactly sure what it is, either. Is it a server-side language interpreter? As I understand it, I place the jQuery.js file into my html folder on myserver. Then, I create an external .js file, similar to a .css file, that houses all the javascript code for my html file. I like the sound of Write Less, Do more, but I do not know how to get started. I appreciate any help I can get. Thanks, -K
[jQuery] Download size of jquery 1.3.2
I noticed on the latest release of jquery, the site says download size is 19KB for production, but the real size is 55.9KB, which is a substantial difference. Why is it so large? One of the things I have always liked about jquery is its small footprint, and I would no longer call this small. Is this an error in the release, or has jquery really grown so large? I really hope it is not the later, but the last few releases seem to be following a trend of getting larger and larger.
[jQuery] Showing page after events bind
Hi there, I am developing a website and am wondeirng, what happens if the user clicks on a button or a link even before the event gets binded to it. I am attaching events on DOM ready function, but am thinking if there is a way to not let the user interact with the page until i want them to - what would be the best solution for this? Any help is highly appreciated Thanks Vru
[jQuery] Highlight a table row on radio button click
I have a table in which each row has radio botton in first td. I have to make a code so that when user click on radio button that row get highlighted . When click other that get highlighted and rest without highlight
[jQuery] Datatables Plugin Default Sort Column
Hello, Does anyone know whether it is possible to define a default sort column for the jQuery Datatables plugin (http://www.sprymedia.co.uk/ article/DataTables) for when the table of data first loads? Many thanks, Simon
[jQuery] Re: question about dealing with JSON callback
I'm sorry about heisting this thread, but I cannot figure out how to post to this group. I click new post, type in my prose, and click post, but it never appears in the topic list. Does anyone know what I'm doing wrong? Thanks, -K
[jQuery] jQuery problem in php
hi all,i face some problem in php,when i using html2php (http:// www.quasarcr.com/html2php/ ) convert my html code to php the jquery scrollTop will not work. but if i using html is work ? how to solve this problem? Here is my normal code (html) url http://www.multiesdesign.com/test/ u can try the button it work on html but when i convert to php the scroll effect will never work again. thank you below is my code -- print !DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'; print html xmlns='http://www.w3.org/1999/xhtml'; print head; print meta http-equiv='Content-Type' content='text/html; charset=utf-8' /; print titleMadre/title; print !DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'; print html xmlns='http://www.w3.org/1999/xhtml'; print ; print ; print style type='text/css'; print !--; print .style3 {font-size: 36px}; print .style5 {font-size: 12px}; print --; print /style; print head; print meta http-equiv='Content-Type' content='text/html; charset=utf-8' /; print titleMadre/title; print script type='text/javascript' src='scripts/jquery.latest.js'/ script; print script type='text/javascript' src='scripts/ thickbox.compressed.js'/script; print script type='text/javascript'; print !--; print $(document).ready(function(){; print $('a[href*=#]').click(function() {; print if (location.pathname.replace(/^\//,'') == this.pathname.replace (/^\//,''); print location.hostname == this.hostname) {; print var $target = $(this.hash);; print $target = $target.length $target; print || $('[name=' + this.hash.slice(1) +']');; print if ($target.length) {; print var targetOffset = $target.offset().top -30;; print $('html,body'); print .animate({scrollTop: targetOffset}, 750);; print return false;; print }; print }; print });; print });; print --; print /script; print ; print link href='styles/main.css' rel='stylesheet' type='text/css' / ; print style type='text/css'; print !--; print .style2 {color: #FF}; print .style4 {color: #FF}; print .style7 {font-size: 9}; print .style9 {font-size: 18px}; print .style12 {font-size: 16px}; print .style13 {color: #FF; font-size: 16px; }; print --; print /style; print /head; print ; print body; print pa name='top'/a/p; print div id='main_container'; print div id='navigation'; print ; print ul; print lih1a href='#term' class='style13'Term/a/h1; print /li; print lih1a href='#contact' class='style13'Contact/a/h1; print /li; print lih1a href='#product' class='style13'Product/a/h1; print /li; print lih1a href='#about' class='style2 style12'About/a/ h1; print /li; print lih1a href='#home' class='style12 style2'strongHome/ strong/a/h1; print /li; print /ul; print a name='work' id='work'/a; print pnbsp;/p; print div id='header_bg'; print h1span class='hidden'Associatedflavors.com/span/h1; print pnbsp;/p; print /div; print div class='page_container'; print h3 class='style3'span class='style4'H/spanomea name='home' id='home'/a/h3; print h2Title01/h2; print pWelcome to Associatedflavors.com. My name is Daniel Strabley, I am a 25 year old Creative Developer in Chicago Illinois and this is my portfolio and blog. Please take some time to look over what I have and learn a little more about me - strongI am for hire!/ strong/p; print h2Title02/h2; print pBy the way, if you have an iPhone and for the love of god you should! Please visit my mobile companion site. This site will redirect you when you open it on your phone./p; print pa href='#top' class='style4'Back To Top/a/p; print /div; print div class='page_container'; print h4 class='news style5'nbsp;/h4; print /div; print ; print ; print ; print pnbsp;/p pnbsp;/p; print div class='page_container'; print pnbsp;/p; print /div; print ; print div class='page_container'; print h3 class='style3'span class='style4'C/spanontacta name='contact' id='contact'/a/h3; print h2Companynbsp;nbsp;--span class='style7'nbsp;nbsp;span class='style9'name/span/span/h2; print h2Addressnbsp;nbsp;nbsp;nbsp;--span class='style7'nbsp;nbsp;span class='style9'Address/span/span/ h2; print h2Telnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp;nbsp;nbsp;--span class='style7'nbsp;nbsp;span class='style9'Tel/span/span/h2; print h2H.Pnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp;nbsp;--span class='style7'nbsp;nbsp;span class='style9'H.P/span/span/h2; print h2Faxnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp;nbsp;--span class='style7'nbsp;nbsp;span class='style9'Fax/span/span/h2; print h2E-mailnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;--span class='style7'nbsp;nbsp;span class='style9'E-mail/span/span/ h2; print nbsp;; print nbsp;; print pa href='#top' class='style4'Back To Top/a/p; print /div; print /ul; print ; print ; print div class='page_container'; print h3 class='style3'span class='style4'T/spanerma name='term' id='term'/a/h3; print pinformation and Usesnbsp;nbsp;; print nbsp;; print
[jQuery] I'm using jquery colorbox for video and picture, it is auto-resized
http://colorpowered.com/colorbox/
[jQuery] hover problems
Been searching for the last hour, found some solutions, but still not good enough. I have a navigation menu -- when I hover over a header, I want the submenus to slideDown, and then on hoverOut, I want it to slide back in. First, I was having problems with it only displaying 2 or 3 of the dropdown items if I got crazy with the hovering (on, off, on, off quite rapidly). Then I found the .css(overflow:visible) fix. That causes the menu to at least always display all the items, but the effect is lost if you hover on/off quickly. What am I missing? This can't be this hard. Here's the link: http://www.threedaysaside.com/cep Javascript: $(document).ready(function() { $(.sub_div).hide(); /*$(.sub_div).css('opacity', 0.9);*/ $(.subnav_a).hover(function() { $(.sub_div).stop().css('overflow', 'visible').slideDown(800); }, function() { $(.sub_div).stop().css('overflow', 'visible').slideUp(300); }); }); The Residential link is the only one with a dropdown. And don't worry about the styling, I haven't even had a chance to worry about it myself yet.
[jQuery] news headlines
I have a latest news headline 'box' included on a home page and a seperate news page with the full stories on. The news page has a table with a heading newsheadline and i want the latest news 'box' to just grab the top 5 news headlines from the news page so i only have to update the news page. please help!! if you want to look at code, the pages are www.t-dub.co.uk/WHC/site/index.shtml (this has the latest news headlines box) and ./news.shtml for the news page. Thanks
[jQuery] How to pick out classes that start with a particular string.
This might be hard to explain, but I need a way to loop through a bunch of elements I've already selected and for each one find classes that start with the word icon. So for example I might have the following elements div class=button iconStar/div div class=button iconPlus/div div class=button iconLeft/div div class=button iconRight/div div class=button iconUp/div div class=button iconDown/div So, I begin by selecting the elements and looping through them $(.button).each(function(){ // Some code here }); Now, I could put the following code in the loop... if ($(this).hasClass(iconStar)){ $(this).append(IMG SRC='Images/star.gif'); } I would then have to repeat that for each possible icon, which seems very inefficient. What I'd like to do in the each loop is just cycle through all the classes that $(this) has and pick out the one that begins with ICON and then use that to append the image. Can anyone help?
[jQuery] Re: question about dealing with JSON callback
Hi, Kyle... Perhaps, since you are apparently new to the group, your new posts are being moderated pending approval? Rick On Wed, Apr 15, 2009 at 7:41 PM, Kyle gandalfisarocks...@gmail.com wrote: I'm sorry about heisting this thread, but I cannot figure out how to post to this group. I click new post, type in my prose, and click post, but it never appears in the topic list. Does anyone know what I'm doing wrong? Thanks, -K -- - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson
[jQuery] Re: Complete noob needs help setting up jquery in windows XP
Hi, Kyle...looks like your messages are finally arriving on the list! Have you worked through any of the tutorials on www.jquery.com? That's a great place to start. There are many introductory tutorials there. Rick On Wed, Apr 15, 2009 at 7:16 PM, Kyle gandalfisarocks...@gmail.com wrote: I am an amatuer website creator and like to use the most accepted and best methods of developing on a site. I learned how CSS simplified how HTML looks and now I've been reading about how jQuery simplifies how HTML acts with javascript. Right away I ran into a wall. I am using Windows XP and Microsoft Expression Web 2 to create my site. I cannot figure out how to build, make, unpack jQuery. I'm not exactly sure what it is, either. Is it a server-side language interpreter? As I understand it, I place the jQuery.js file into my html folder on myserver. Then, I create an external .js file, similar to a .css file, that houses all the javascript code for my html file. I like the sound of Write Less, Do more, but I do not know how to get started. I appreciate any help I can get. Thanks, -K -- - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson
[jQuery] Re: How to pick out classes that start with a particular string.
It would be MUCH easier and cleaner to separate icon and Star/ PlusLeft/Right/Up/Down, a la: div class=button icon Star/div div class=button icon Plus/div div class=button icon Left/div div class=button icon Right/div div class=button icon Up/div div class=button icon Down/div If that's possible, that seriously would make your code easier and less complicated On Apr 16, 8:58 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: This might be hard to explain, but I need a way to loop through a bunch of elements I've already selected and for each one find classes that start with the word icon. So for example I might have the following elements div class=button iconStar/div div class=button iconPlus/div div class=button iconLeft/div div class=button iconRight/div div class=button iconUp/div div class=button iconDown/div So, I begin by selecting the elements and looping through them $(.button).each(function(){ // Some code here }); Now, I could put the following code in the loop... if ($(this).hasClass(iconStar)){ $(this).append(IMG SRC='Images/star.gif'); } I would then have to repeat that for each possible icon, which seems very inefficient. What I'd like to do in the each loop is just cycle through all the classes that $(this) has and pick out the one that begins with ICON and then use that to append the image. Can anyone help?
[jQuery] Re: hover problems
Check out the Hover Intent plugin here: http://cherne.net/brian/resources/jquery.hoverIntent.html I think it's just what you're looking for. Rick On Thu, Apr 16, 2009 at 12:28 AM, 3daysaside 3daysas...@gmail.com wrote: Been searching for the last hour, found some solutions, but still not good enough. I have a navigation menu -- when I hover over a header, I want the submenus to slideDown, and then on hoverOut, I want it to slide back in. First, I was having problems with it only displaying 2 or 3 of the dropdown items if I got crazy with the hovering (on, off, on, off quite rapidly). Then I found the .css(overflow:visible) fix. That causes the menu to at least always display all the items, but the effect is lost if you hover on/off quickly. What am I missing? This can't be this hard. Here's the link: http://www.threedaysaside.com/cep Javascript: $(document).ready(function() { $(.sub_div).hide(); /*$(.sub_div).css('opacity', 0.9);*/ $(.subnav_a).hover(function() { $(.sub_div).stop().css('overflow', 'visible').slideDown(800); }, function() { $(.sub_div).stop().css('overflow', 'visible').slideUp(300); }); }); The Residential link is the only one with a dropdown. And don't worry about the styling, I haven't even had a chance to worry about it myself yet. -- - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson
[jQuery] Re: Complete noob needs help setting up jquery in windows XP
Kyle wrote: I am an amatuer website creator and like to use the most accepted and best methods of developing on a site. I learned how CSS simplified how HTML looks and now I've been reading about how jQuery simplifies how HTML acts with javascript. Right away I ran into a wall. I am using Windows XP and Microsoft Expression Web 2 to create my site. I cannot figure out how to build, make, unpack jQuery. I'm not exactly sure what it is, either. Is it a server-side language interpreter? jQuery is javascript code. It run on user's browser, when the user load the web page. As I understand it, I place the jQuery.js file into my html folder on myserver. Then, I create an external .js file, similar to a .css file, that houses all the javascript code for my html file. jQuery is no different than other javascript. If you can write script type=text/javascript alert(Hello World); /script and successfully got the alert dialog box, then you can code in jQuery. I like the sound of Write Less, Do more, but I do not know how to get started. I appreciate any help I can get. Do you have a real problem to solved using javascript? I found the easier way to learn something is when I have real world case that I want/need to solved. Here is one of interesting use of jQuery (it's featured on the jquery website) Hide an paragraph, when a user click a link, show that paragraph. Try to figure a way to do it, then look for jQuery feature to solve that. Happy learning :) Thanks, -K -- Assalamu'alaikum wr wb Wassalamu'alaikum wr wb -- Donny Kurnia http://hantulab.blogspot.com http://www.plurk.com/user/donnykurnia
[jQuery] Re: How to pick out classes that start with a particular string.
Thanks MorningZ, but does that dolve the problem? I'd still have to do a .hasClass() for each possible icon, wouldn't I? On Apr 16, 2:03 pm, MorningZ morni...@gmail.com wrote: It would be MUCH easier and cleaner to separate icon and Star/ PlusLeft/Right/Up/Down, a la: div class=button icon Star/div div class=button icon Plus/div div class=button icon Left/div div class=button icon Right/div div class=button icon Up/div div class=button icon Down/div If that's possible, that seriously would make your code easier and less complicated On Apr 16, 8:58 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: This might be hard to explain, but I need a way to loop through a bunch of elements I've already selected and for each one find classes that start with the word icon. So for example I might have the following elements div class=button iconStar/div div class=button iconPlus/div div class=button iconLeft/div div class=button iconRight/div div class=button iconUp/div div class=button iconDown/div So, I begin by selecting the elements and looping through them $(.button).each(function(){ // Some code here }); Now, I could put the following code in the loop... if ($(this).hasClass(iconStar)){ $(this).append(IMG SRC='Images/star.gif'); } I would then have to repeat that for each possible icon, which seems very inefficient. What I'd like to do in the each loop is just cycle through all the classes that $(this) has and pick out the one that begins with ICON and then use that to append the image. Can anyone help?
[jQuery] Re: selecting li - beginner learning jquery
thank you!
[jQuery] Re: How to pick out classes that start with a particular string.
Well, other than asking whether or not an object has a class or doesn't, there isn't much you can do that check each class name so like (and this assumes your original HTML, not the separated class name) : var icons = [Star, Plus, Left, Right, Up, Down]; $(div.button).each(function() { var $dv = $(this); $.each(icons, function() { if ($dv.hasClass(icon + this)) { $dv.append('img src=Images/' + this + '.gif alt= /'); return false; } }); }); On Apr 16, 9:08 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: Thanks MorningZ, but does that dolve the problem? I'd still have to do a .hasClass() for each possible icon, wouldn't I? On Apr 16, 2:03 pm, MorningZ morni...@gmail.com wrote: It would be MUCH easier and cleaner to separate icon and Star/ PlusLeft/Right/Up/Down, a la: div class=button icon Star/div div class=button icon Plus/div div class=button icon Left/div div class=button icon Right/div div class=button icon Up/div div class=button icon Down/div If that's possible, that seriously would make your code easier and less complicated On Apr 16, 8:58 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: This might be hard to explain, but I need a way to loop through a bunch of elements I've already selected and for each one find classes that start with the word icon. So for example I might have the following elements div class=button iconStar/div div class=button iconPlus/div div class=button iconLeft/div div class=button iconRight/div div class=button iconUp/div div class=button iconDown/div So, I begin by selecting the elements and looping through them $(.button).each(function(){ // Some code here }); Now, I could put the following code in the loop... if ($(this).hasClass(iconStar)){ $(this).append(IMG SRC='Images/star.gif'); } I would then have to repeat that for each possible icon, which seems very inefficient. What I'd like to do in the each loop is just cycle through all the classes that $(this) has and pick out the one that begins with ICON and then use that to append the image. Can anyone help?
[jQuery] Re: question about dealing with JSON callback
Kyle wrote: I'm sorry about heisting this thread, but I cannot figure out how to post to this group. I click new post, type in my prose, and click post, but it never appears in the topic list. Does anyone know what I'm doing wrong? Thanks, -K Since you using gmail, you don't get your own email when you post to a mailing list. When your original message got reply, it will continue your original email, in gmail it's called a conversation. This is the main reason why you don't get your own email in gmail. So, after you send email to mailing list, give that email the label you usually use for that mailing list. If somehow your email failed to reach mailing list, gmail will wend you an information email. So, don't worry about it. -- Donny Kurnia http://hantulab.blogspot.com http://www.plurk.com/user/donnykurnia
[jQuery] Re: jQuery.post() not working for me
spstieng wrote: Hi, I'm trying to use jQuery.post() function to retrieve som data. But i get no ouput. My PHP file looks like this: ?php inlcude_once('dal.php'); //Get store data, and ouput it as JSON. function getStoreInformation($storeID) { $sl = new storeLocator(); $result = $sl-getStoreData($storeID); while ($row = mysqli_fetch_assoc($result)) { { $arr[] = $row; } $storeData = json_encode($arr); echo $storeData; //Output JSON data } ? This is my javascript which is located in /js/myscripts.js jQuery(document).ready(function() { jQuery('#storeListTable tr').click(function() { jQuery.post(../functions.php, { func: getStoreInformation }, function(data){ alert(data.name); // To test if I get any output //$('#store_name').val(data.name); // I could do this to populate my form //$(#store_data_form).populate(data, {debug:1}) //But I probably will use jQuery Populate plugin instead }, json); }); }); If this is working, I should be able to get an alert message, right? Try running it in firefox with firebug extention. Open the console tab in firebug to see your XMLHttpRequest request and response from the php. -- Donny Kurnia http://hantulab.blogspot.com http://www.plurk.com/user/donnykurnia
[jQuery] Re: jQuery.post() not working for me
I haven't figured out how to use this yet. How can I debug a javascript file? I only see the html code from my index.php. (I have lots of experience using debugger tool in Visual Studio) Steven On 16 Apr, 15:19, Donny Kurnia donnykur...@gmail.com wrote: Try running it in firefox with firebug extention. Open the console tab in firebug to see your XMLHttpRequest request and response from the php. -- Donny Kurniahttp://hantulab.blogspot.comhttp://www.plurk.com/user/donnykurnia
[jQuery] Re: Data() method, just changing value of one hash element
Try: $j.data(item, 'attributes').WarehouseKey = $j('# %=ItemWarehouseList.ClientId%').val(); On Apr 16, 8:12 am, Richard D. Worth rdwo...@gmail.com wrote: On Wed, Apr 15, 2009 at 1:50 AM, Dhana sldh...@gmail.com wrote: I am using the jQuery Data method to store data for dynamically created elements. Everything works fine until I try to update the value of an attribute. This is how I first create the element. $j.data(item, 'attributes', { Name: name, UOM: uom, WarehouseKey: orderItem.WarehouseKey, OriginalPrice: orderItem.OriginalPrice, ReqDate: dsOrder.cleanupResults(orderItem.ReqDate), WarehouseItemKey: orderItem.WarehouseItemKey, AvailableQty: orderItem.AvailableQty, BOQty: orderItem.BOQty, Notes: dsOrder.cleanupResults(orderItem.Notes), Cost: orderItem.Cost, GP: dsOrder.cleanupResults(orderItem.GP), Description: dsOrder.cleanupResults (orderItem.description) }); At a later point based on a user's interaction, the required date, note, and warehouse key gets updated. This is the first way I tried updating it, it doesn't store the value. $j(item, 'attributes.ReqDate', $j('#section_item #requiredDate').attr ('value')); This doesn't work because the text after the dot (.) is the namespace of the data attribute. Then I tried it like this $j.data(item, 'attributes', { 'WarehouseKey': $j('#%=ItemWarehouseList.ClientId %').val() }); This overwrited all the other data stored in 'attributes'. Only WarehouseKey is then saved. Is there a way to change just one value without affecting the rest of the data? Grab the hash, modify the value, then put it back: var attr = $j.data(item, 'attributes'); attr.WarehouseKey = $j('#%=ItemWarehouseList.ClientId%').val(); $j.data(item, 'attributes', attr); - Richard
[jQuery] Re: JQuery.isReady property
The jQuery isReady property was designed to do exactly what you're trying to accomplish. If you call: $(function(){}); before the DOMReady, it will trigger the function once it occurs. If you call it after the DOMReady, it will trigger immediately. The isReady property exists so, when it's false, it binds events, and when its true, it just triggers them. On Apr 16, 7:41 am, blasto333 m...@chrismuench.com wrote: JQuery.isReady is NOT documented, but I have a valid use case for it and was wondering if there is a documented way of doing the same thing. I have a case where some code could be loaded as the page loads, but I don't have a particular function to fire until the document isReady. The same code could also be loaded in a context after the page loads (Injected into the dom) if (JQuery.isReady) { //Call function explicitly} else { //Call function on document.ready() }
[jQuery] columnFilters
Hello, I download the columnFilters plugins and test it, every thing is working fine. But, I want to filter my table on one specific column, so the added filter row above the table header is not relevant for me. I'm trying to modify the jquery.columnfilters.js that it will work with text file that I put outsite the table on the top. The code look like this. But, it's not working. $(#filter_field).keyup(function(event){ // call the runFilters(event); alert( filter_field !); }); Can somebody help with this. Tks
[jQuery] Re: how to select elements inside jQuery objects
It's called context. Using your example, if you wanted to select all items with a class of .mol_row INSIDE the jQuery object mol_elements, you'd do this: $(.mol_row, mol_elements) That selector says look for .mol_row in the context of mol_elements. Andy matthews -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of hybris77 Sent: Thursday, April 16, 2009 3:48 AM To: jQuery (English) Subject: [jQuery] how to select elements inside jQuery objects i've tried to do the following on a grand scale the last few days, please help my suggestion to select a classname inside a object containing the xhtml $( mol_elements .mol_row ).append( td+ molname +/td); I was then suggested the following, but that selects BOTH class and element, right? $( .mol_row, mol_elements ).append( td+ molname +/td); how to select the classname inside the object then? /pär
[jQuery] Re: jQuery.post() not working for me
By hitting F12, firebug opens up in Firefox. On the first use, you have to check all three options (Console, Javascript, Network). After reloading the page, you can see the requests and its answers under Console. Under Script, you can debug your scripts. Above Script you can select which script to debug. There you can set a breakpoint. That's it. On 16 Apr., 15:25, spstieng spsti...@hotmail.com wrote: I haven't figured out how to use this yet. How can I debug a javascript file? I only see the html code from my index.php. (I have lots of experience using debugger tool in Visual Studio) Steven On 16 Apr, 15:19, Donny Kurnia donnykur...@gmail.com wrote: Try running it in firefox with firebug extention. Open the console tab in firebug to see your XMLHttpRequest request and response from the php. -- Donny Kurniahttp://hantulab.blogspot.comhttp://www.plurk.com/user/donnykurnia
[jQuery] Re: jQuery.post() not working for me
Josch wrote: By hitting F12, firebug opens up in Firefox. On the first use, you have to check all three options (Console, Javascript, Network). After reloading the page, you can see the requests and its answers under Console. Under Script, you can debug your scripts. Above Script you can select which script to debug. There you can set a breakpoint. That's it. On 16 Apr., 15:25, spstieng spsti...@hotmail.com wrote: I haven't figured out how to use this yet. How can I debug a javascript file? I only see the html code from my index.php. (I have lots of experience using debugger tool in Visual Studio) Steven On 16 Apr, 15:19, Donny Kurnia donnykur...@gmail.com wrote: Try running it in firefox with firebug extention. Open the console tab in firebug to see your XMLHttpRequest request and response from the php. -- Donny Kurniahttp://hantulab.blogspot.comhttp://www.plurk.com/user/donnykurnia Great explanation Josch. I just know that the shortcut is F12, for all the time I just click the 'bug' icon in status bar :) Open the Console tab. When the page do the post request, it will appear there. Click the [+] icon to display detail info for that XMLHttpRequest. Also see the Net tab to check if there are page's resource that missing (404 error). -- Donny Kurnia http://hantulab.blogspot.com http://www.plurk.com/user/donnykurnia
[jQuery] Re: How to pick out classes that start with a particular string.
Here is some psuedo-code for what I'm trying to achieve... $(.button).each(function(){ // Get an array of classes that are attached to $(this) // Loop through the array classes for (items in array){ // check to see if the class starts with icon if(className.startswith('icon')){ // remove the first 4 characters var iconName = className.substring(4, className.length); // Use the remainder to append the image $(this).append(IMG SRC=' + iconName + .gif'); } } }); That way, I could have hundreds of possible icons and I wouldn't have to have hundreds of IF statements and hundreds of calls to .hasClass() On Apr 16, 2:16 pm, MorningZ morni...@gmail.com wrote: Well, other than asking whether or not an object has a class or doesn't, there isn't much you can do that check each class name so like (and this assumes your original HTML, not the separated class name) : var icons = [Star, Plus, Left, Right, Up, Down]; $(div.button).each(function() { var $dv = $(this); $.each(icons, function() { if ($dv.hasClass(icon + this)) { $dv.append('img src=Images/' + this + '.gif alt= /'); return false; } }); }); On Apr 16, 9:08 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: Thanks MorningZ, but does that dolve the problem? I'd still have to do a .hasClass() for each possible icon, wouldn't I? On Apr 16, 2:03 pm, MorningZ morni...@gmail.com wrote: It would be MUCH easier and cleaner to separate icon and Star/ PlusLeft/Right/Up/Down, a la: div class=button icon Star/div div class=button icon Plus/div div class=button icon Left/div div class=button icon Right/div div class=button icon Up/div div class=button icon Down/div If that's possible, that seriously would make your code easier and less complicated On Apr 16, 8:58 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: This might be hard to explain, but I need a way to loop through a bunch of elements I've already selected and for each one find classes that start with the word icon. So for example I might have the following elements div class=button iconStar/div div class=button iconPlus/div div class=button iconLeft/div div class=button iconRight/div div class=button iconUp/div div class=button iconDown/div So, I begin by selecting the elements and looping through them $(.button).each(function(){ // Some code here }); Now, I could put the following code in the loop... if ($(this).hasClass(iconStar)){ $(this).append(IMG SRC='Images/star.gif'); } I would then have to repeat that for each possible icon, which seems very inefficient. What I'd like to do in the each loop is just cycle through all the classes that $(this) has and pick out the one that begins with ICON and then use that to append the image. Can anyone help?
[jQuery] Re: Plugin does not bind to jQuery object
That was it. jQuery was being loaded just before /body, so it was overwriting the jQuery object loaded earlier (via the custom page). By moving this to the top and deleting the extra script reference, I fixed the problem. Thanks! Thomas On Apr 16, 12:37 am, Thomas Allen thomasmal...@gmail.com wrote: This is possible, and makes sense. I'll take a look tomorrow (the main template for this site includes jQuery, and we include these scripts on forms, which is where things got mixed up). Thomas On Apr 15, 4:55 pm, Eric Garside gars...@gmail.com wrote: Upon further inspection, I'm not quite sure what to make of your page. Firebug's Net console reported the following includes in the following order: 1. jquery-1.3.2.js 2. jquery.validate.min.js 3. validate-common.js 4. asce03.js 5. validate.js 6. jquery-1.2.6.js 7. jquery-dropdown-menus.js So, for one reason or another, you're including 2 different versions of jQuery on the same page. I'm not sure if that's causing the issue, but I can't imagine it's useful or efficient. I'd check into that as a first-line of defense. Removing the older jQuery version might fix it? On Apr 15, 4:44 pm, Thomas Allen thomasmal...@gmail.com wrote: No, that's not it. The scripts are ordered: script src=/lib/javascript/jquery-1.3.2.js type=text/javascript/ script script src=/lib/javascript/jquery.validate.min.js type=text/ javascript/script Which is why only one exception is thrown. If I flip the order of those two, two exceptions are thrown, one for the missing jQuery object, and another for the validate method. Ignore the reference to validate.js in the head, that's not being used here. Thomas On Apr 15, 4:39 pm, Eric Garside gars...@gmail.com wrote: It's the order of your includes. In the first page, you're including the validation plugin before you're including jQuery. The result is that, when validation attempts to enter itself into the jQuery namespace, jQuery is undefined, so it just dies within it's enclosure. On Apr 15, 4:30 pm, Thomas Allen thomasmal...@gmail.com wrote: These two pages do the exact same thing: Apply some basic validation rules to a form. The only difference is that the first one includes the scripts in body, not head. 1.http://www.asce.org/freemembership/ 2.http://content.asce.org/conferences/texasstudentdays/company_registra... The second one works, and the first doesn't. For some reason, the first site doesn't bind the validate method to jQuery. $.fn.validate() throws an exception in the console. What's going on, and how can I fix this problem? The file itself is definitely being loaded. Thanks, Thomas
[jQuery] Re: Download size of jquery 1.3.2
The quoted size includes gzip compression which is done by the server and undone by your browser before you can save the file. For more, see http://groups.google.com/group/jquery-en/browse_thread/thread/16e294e2f3b8f3eb http://groups.google.com/group/jquery-en/browse_thread/thread/563ebd5a961d401 http://groups.google.com/group/jquery-en/browse_thread/thread/3a5d4093f0c74a4a http://groups.google.com/group/jquery-en/browse_thread/thread/790dc1745f0816f8 - Richard On Wed, Apr 15, 2009 at 10:30 PM, jayg jason.guidi...@gmail.com wrote: I noticed on the latest release of jquery, the site says download size is 19KB for production, but the real size is 55.9KB, which is a substantial difference. Why is it so large? One of the things I have always liked about jquery is its small footprint, and I would no longer call this small. Is this an error in the release, or has jquery really grown so large? I really hope it is not the later, but the last few releases seem to be following a trend of getting larger and larger.
[jQuery] recommendation for lightbox
what do u recommend for a lightbox plugin? there are alot out there
[jQuery] Re: jQuery.post() not working for me
Ah, got it. The Post is correct and the Respons is correct... I think. It's in JSON, but not sure if it's correct. According to http://docs.jquery.com/Ajax/jQuery.post, last example, they have the following line in the php file: ?php echo json_encode(array(name=John,time=2pm)); ? This is why they can output the info by alert(data.name). But if I try this: while ($row = mysql_fetch_array($result)) { $data[] = array( id=($row['id']) , name=($row['name'])); } $storeData = json_encode($data); I still get 'undefined' output :( On 16 Apr, 15:36, Josch jluelsd...@googlemail.com wrote: By hitting F12, firebug opens up in Firefox. On the first use, you have to check all three options (Console, Javascript, Network). After reloading the page, you can see the requests and its answers under Console. Under Script, you can debug your scripts. Above Script you can select which script to debug. There you can set a breakpoint.
[jQuery] Re: How to pick out classes that start with a particular string.
The problem I see is what happens when there is more than one class? Your icon call may not be the first class. in which case you would not have selected it. But it was still supposed to get an icon. Would it be possible to give the divs that are supposed to receive the icons a generic class then use an attribute to define what icons it is supposed to have. You could even reduce the amount of code that you have to output. div class=icon button img=Star/div $(.button).each(function(){ if ($(this).hasAttribute(img) $(this).attr(img) != ) { $(this).append(IMG SRC=' + $(this).attr(img) + .gif'); } ) I know that it is probably not the best code as you are using attibutes that do not fall into the dom standards but it looks like it would get the job done. On Apr 16, 8:51 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: Here is some psuedo-code for what I'm trying to achieve... $(.button).each(function(){ // Get an array of classes that are attached to $(this) // Loop through the array classes for (items in array){ // check to see if the class starts with icon if(className.startswith('icon')){ // remove the first 4 characters var iconName = className.substring(4, className.length); // Use the remainder to append the image $(this).append(IMG SRC=' + iconName + .gif'); } } }); That way, I could have hundreds of possible icons and I wouldn't have to have hundreds of IF statements and hundreds of calls to .hasClass() On Apr 16, 2:16 pm, MorningZ morni...@gmail.com wrote: Well, other than asking whether or not an object has a class or doesn't, there isn't much you can do that check each class name so like (and this assumes your original HTML, not the separated class name) : var icons = [Star, Plus, Left, Right, Up, Down]; $(div.button).each(function() { var $dv = $(this); $.each(icons, function() { if ($dv.hasClass(icon + this)) { $dv.append('img src=Images/' + this + '.gif alt= /'); return false; } }); }); On Apr 16, 9:08 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: Thanks MorningZ, but does that dolve the problem? I'd still have to do a .hasClass() for each possible icon, wouldn't I? On Apr 16, 2:03 pm, MorningZ morni...@gmail.com wrote: It would be MUCH easier and cleaner to separate icon and Star/ PlusLeft/Right/Up/Down, a la: div class=button icon Star/div div class=button icon Plus/div div class=button icon Left/div div class=button icon Right/div div class=button icon Up/div div class=button icon Down/div If that's possible, that seriously would make your code easier and less complicated On Apr 16, 8:58 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: This might be hard to explain, but I need a way to loop through a bunch of elements I've already selected and for each one find classes that start with the word icon. So for example I might have the following elements div class=button iconStar/div div class=button iconPlus/div div class=button iconLeft/div div class=button iconRight/div div class=button iconUp/div div class=button iconDown/div So, I begin by selecting the elements and looping through them $(.button).each(function(){ // Some code here }); Now, I could put the following code in the loop... if ($(this).hasClass(iconStar)){ $(this).append(IMG SRC='Images/star.gif'); } I would then have to repeat that for each possible icon, which seems very inefficient. What I'd like to do in the each loop is just cycle through all the classes that $(this) has and pick out the one that begins with ICON and then use that to append the image. Can anyone help?- Hide quoted text - - Show quoted text -
[jQuery] IE: jQuery leaking memory on blank page
Hi all, I've been trying to fix some memory leaks in my app. As I was stripping the code down I discovered that even on a totally blank page that includes jQuery, memory is leaked. If you point Drip at the jquery.com homepage you'll see quite a few elements left around after the page unloads. It seems to be mostly stuff in jquery.support (script tags, anchor tags, divs) that are used to test browser capabilities. Is this a known issue? Is there any workaround? It seems to be the removeChild calls causing most of it (but removing them obviously laves random elements in the dom). Our app is likely to be kept open in the browser for the entire day, with a lot of page loads, so we're keen to address any memory leaks. Any ideas what I can do about this?
[jQuery] Re: how can I delete all elements: children and parent
$(#57).parent().empty() could work. check here: http://docs.jquery.com/Manipulation On Thu, Apr 16, 2009 at 6:01 PM, dziobacz aaabbbcccda...@gmail.com wrote: I have: span id='57' bla bla bla br/ a href='#' something1 /abr/ a href='#' onclick='clickk(57); return false;' DELETE /a br/br/ /span How can I delete span element with id=57 and also everything inside ?
[jQuery] binding after .get()
Hi, I am new to jQuery and can't get my head around the binding concept. I read some posts about it, but can't seem to figure out how to bind data coming from $.get('script.php', {'c': c, 'sc': sc }, function (data) {...} It's now loaded using: $('form').html(data); replacing the normal form completely (which is what I want). It loads a bunch of selectors which I get from my php script. I need to use jQuery on those selectors (at change) as well and understand I need to bind them... And then I am bluntly staring at my screen - not knowing how to proceed... Thanks in advance for your reply! Henjo
[jQuery] Re: Highlight a table row on radio button click
Nitin, paste some code/snippets here. Will help us to help you. -raja On Thu, Apr 16, 2009 at 5:48 PM, Nitin Gautam gautam.ni...@gmail.com wrote: I have a table in which each row has radio botton in first td. I have to make a code so that when user click on radio button that row get highlighted . When click other that get highlighted and rest without highlight
[jQuery] binding after .get()
Hi all, new to jQuery I am having difficulty on the binding concept. Currently using this function to regenerate a full form based on a PHP script. -- $(select).change(function () { $.get('script.php', {'c': c, 'sc': sc }, function(data) { $('form').html(data); }); return false; }) .change(); -- This works, but I'd like to use some next steps in the newly created selectors. I understand I need to (re)bind these selectors, but am lost on how to achieve that. Anyone? Thanks in advance, Henjo
[jQuery] href+external link focus under window
Hello, I have a thickbox window with links. For one of these links, I would call an external site, but below my current page and close my thickbox. Is this possible? Thank you all.
[jQuery] $(button).Bind(click, function) Vs button onClick=function/
I know that the recommended usage in all the books/blogs/web sites is the bind() method in the$(document).ready(function() {} However I am finding that very often my users are taking action by clicking etc before the page has completely loading. This usually results in a full form postback instead of AJAX, or worse nothing happens at all. I understand that the bind method within the .ready function works best if the handler requires an element further down the page that may not have been loaded yet. But if I do not rely on anything further down the page, is there any good reason not to use the onClick= attribute, to wire-up my event handlers immediately rather than waiting for the full page to be loaded?
[jQuery] Re: How to pick out classes that start with a particular string.
Actual after reading it again I like MorningZ's solution better. On Apr 16, 9:45 am, David david.sulli...@gmail.com wrote: The problem I see is what happens when there is more than one class? Your icon call may not be the first class. in which case you would not have selected it. But it was still supposed to get an icon. Would it be possible to give the divs that are supposed to receive the icons a generic class then use an attribute to define what icons it is supposed to have. You could even reduce the amount of code that you have to output. div class=icon button img=Star/div $(.button).each(function(){ if ($(this).hasAttribute(img) $(this).attr(img) != ) { $(this).append(IMG SRC=' + $(this).attr(img) + .gif');} ) I know that it is probably not the best code as you are using attibutes that do not fall into the dom standards but it looks like it would get the job done. On Apr 16, 8:51 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: Here is some psuedo-code for what I'm trying to achieve... $(.button).each(function(){ // Get an array of classes that are attached to $(this) // Loop through the array classes for (items in array){ // check to see if the class starts with icon if(className.startswith('icon')){ // remove the first 4 characters var iconName = className.substring(4, className.length); // Use the remainder to append the image $(this).append(IMG SRC=' + iconName + .gif'); } } }); That way, I could have hundreds of possible icons and I wouldn't have to have hundreds of IF statements and hundreds of calls to .hasClass() On Apr 16, 2:16 pm, MorningZ morni...@gmail.com wrote: Well, other than asking whether or not an object has a class or doesn't, there isn't much you can do that check each class name so like (and this assumes your original HTML, not the separated class name) : var icons = [Star, Plus, Left, Right, Up, Down]; $(div.button).each(function() { var $dv = $(this); $.each(icons, function() { if ($dv.hasClass(icon + this)) { $dv.append('img src=Images/' + this + '.gif alt= /'); return false; } }); }); On Apr 16, 9:08 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: Thanks MorningZ, but does that dolve the problem? I'd still have to do a .hasClass() for each possible icon, wouldn't I? On Apr 16, 2:03 pm, MorningZ morni...@gmail.com wrote: It would be MUCH easier and cleaner to separate icon and Star/ PlusLeft/Right/Up/Down, a la: div class=button icon Star/div div class=button icon Plus/div div class=button icon Left/div div class=button icon Right/div div class=button icon Up/div div class=button icon Down/div If that's possible, that seriously would make your code easier and less complicated On Apr 16, 8:58 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: This might be hard to explain, but I need a way to loop through a bunch of elements I've already selected and for each one find classes that start with the word icon. So for example I might have the following elements div class=button iconStar/div div class=button iconPlus/div div class=button iconLeft/div div class=button iconRight/div div class=button iconUp/div div class=button iconDown/div So, I begin by selecting the elements and looping through them $(.button).each(function(){ // Some code here }); Now, I could put the following code in the loop... if ($(this).hasClass(iconStar)){ $(this).append(IMG SRC='Images/star.gif'); } I would then have to repeat that for each possible icon, which seems very inefficient. What I'd like to do in the each loop is just cycle through all the classes that $(this) has and pick out the one that begins with ICON and then use that to append the image. Can anyone help?- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: How to pick out classes that start with a particular string.
I'm not really sure why you're not just doing this in pure css. .button { padding-right: 20px; background-position: center right; background-repeat: no-repeat; } .iconstar { background-image: url(star.png);} .iconplus { background-image: url(plus.png);} Am I missing something here? Jonathan David wrote: The problem I see is what happens when there is more than one class? Your icon call may not be the first class. in which case you would not have selected it. But it was still supposed to get an icon. Would it be possible to give the divs that are supposed to receive the icons a generic class then use an attribute to define what icons it is supposed to have. You could even reduce the amount of code that you have to output. div class=icon button img=Star/div $(.button).each(function(){ if ($(this).hasAttribute(img) $(this).attr(img) != ) { $(this).append(IMG SRC=' + $(this).attr(img) + .gif'); } ) I know that it is probably not the best code as you are using attibutes that do not fall into the dom standards but it looks like it would get the job done. On Apr 16, 8:51 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: Here is some psuedo-code for what I'm trying to achieve... $(.button).each(function(){ // Get an array of classes that are attached to $(this) // Loop through the array classes for (items in array){ // check to see if the class starts with icon if(className.startswith('icon')){ // remove the first 4 characters var iconName = className.substring(4, className.length); // Use the remainder to append the image $(this).append(IMG SRC=' + iconName + .gif'); } } }); That way, I could have hundreds of possible icons and I wouldn't have to have hundreds of IF statements and hundreds of calls to .hasClass() On Apr 16, 2:16 pm, MorningZ morni...@gmail.com wrote: Well, other than asking whether or not an object has a class or doesn't, there isn't much you can do that check each class name so like (and this assumes your original HTML, not the separated class name) : var icons = [Star, Plus, Left, Right, Up, Down]; $(div.button).each(function() { var $dv = $(this); $.each(icons, function() { if ($dv.hasClass(icon + this)) { $dv.append('img src=Images/' + this + '.gif alt= /'); return false; } }); }); On Apr 16, 9:08 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: - Show quoted text - -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be
[jQuery] Re: How to pick out classes that start with a particular string.
Both of those would work as solutions to this problem. However, I'd still really like to find out if there's a way to get a list (array?) of all of the classes that are currently attached to an element and loop through them. It doesn't dound like it should be so hard. Jon On Apr 16, 3:50 pm, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: I'm not really sure why you're not just doing this in pure css. .button { padding-right: 20px; background-position: center right; background-repeat: no-repeat;} .iconstar { background-image: url(star.png);} .iconplus { background-image: url(plus.png);} Am I missing something here? Jonathan David wrote: The problem I see is what happens when there is more than one class? Your icon call may not be the first class. in which case you would not have selected it. But it was still supposed to get an icon. Would it be possible to give the divs that are supposed to receive the icons a generic class then use an attribute to define what icons it is supposed to have. You could even reduce the amount of code that you have to output. div class=icon button img=Star/div $(.button).each(function(){ if ($(this).hasAttribute(img) $(this).attr(img) != ) { $(this).append(IMG SRC=' + $(this).attr(img) + .gif'); } ) I know that it is probably not the best code as you are using attibutes that do not fall into the dom standards but it looks like it would get the job done. On Apr 16, 8:51 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: Here is some psuedo-code for what I'm trying to achieve... $(.button).each(function(){ // Get an array of classes that are attached to $(this) // Loop through the array classes for (items in array){ // check to see if the class starts with icon if(className.startswith('icon')){ // remove the first 4 characters var iconName = className.substring(4, className.length); // Use the remainder to append the image $(this).append(IMG SRC=' + iconName + .gif'); } } }); That way, I could have hundreds of possible icons and I wouldn't have to have hundreds of IF statements and hundreds of calls to .hasClass() On Apr 16, 2:16 pm, MorningZ morni...@gmail.com wrote: Well, other than asking whether or not an object has a class or doesn't, there isn't much you can do that check each class name so like (and this assumes your original HTML, not the separated class name) : var icons = [Star, Plus, Left, Right, Up, Down]; $(div.button).each(function() { var $dv = $(this); $.each(icons, function() { if ($dv.hasClass(icon + this)) { $dv.append('img src=Images/' + this + '.gif alt= /'); return false; } }); }); On Apr 16, 9:08 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: - Show quoted text - -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be
[jQuery] Re: CTRL+S to Insert Record PHP+JQUERY
do u wanna the sql too? LOL On Thu, Apr 16, 2009 at 2:24 AM, bharani kumar bharanikumariyer...@gmail.com wrote: Hi All , Can u please tell , How to implement in jquery, php,, Insert record after pressed the CTRL+S in keyboard , Thanks -- உங்கள் நண்பன் பரணி குமார் Regards B.S.Bharanikumar POST YOUR OPINION http://bharanikumariyerphp.site88.net/bharanikumar/ -- []´s Jean a.k.a Suissa Tecnólogo em Análise de Sistemas - UTF-PR 131
[jQuery] Re: jQuery.post() not working for me
Please paste here what the servers' response is. On 16 Apr., 16:35, spstieng spsti...@hotmail.com wrote: Ah, got it. The Post is correct and the Respons is correct... I think. It's in JSON, but not sure if it's correct. According tohttp://docs.jquery.com/Ajax/jQuery.post, last example, they have the following line in the php file: ?php echo json_encode(array(name=John,time=2pm)); ? This is why they can output the info by alert(data.name). But if I try this: while ($row = mysql_fetch_array($result)) { $data[] = array( id=($row['id']) , name=($row['name'])); } $storeData = json_encode($data); I still get 'undefined' output :( On 16 Apr, 15:36, Josch jluelsd...@googlemail.com wrote: By hitting F12, firebug opens up in Firefox. On the first use, you have to check all three options (Console, Javascript, Network). After reloading the page, you can see the requests and its answers under Console. Under Script, you can debug your scripts. Above Script you can select which script to debug. There you can set a breakpoint.
[jQuery] Re: $(button).Bind(click, function) Vs button onClick=function/
Try disabling the button, then reenabling it with jQuery? -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of reach4thelasers Sent: Thursday, April 16, 2009 8:39 AM To: jQuery (English) Subject: [jQuery] $(button).Bind(click, function) Vs button onClick=function/ I know that the recommended usage in all the books/blogs/web sites is the bind() method in the$(document).ready(function() {} However I am finding that very often my users are taking action by clicking etc before the page has completely loading. This usually results in a full form postback instead of AJAX, or worse nothing happens at all. I understand that the bind method within the .ready function works best if the handler requires an element further down the page that may not have been loaded yet. But if I do not rely on anything further down the page, is there any good reason not to use the onClick= attribute, to wire-up my event handlers immediately rather than waiting for the full page to be loaded?
[jQuery] Re: jQuery.post() not working for me
Ok, I found the answer. It was as simple as doing this: alert(data[0].name); Notice the [0]. So here is the functional code for anyone who is wondering about this: javascript file --- jQuery(document).ready(function() { jQuery('#storeListTable tr').click(function() { jQuery.post(get_storeData.php, { storeID: this.cells [0].innerHTML }, // this.cells[0].innerHTML is the content ofthe first cell in selected table row function(data){ alert(data[0].name); }, json); }); }); php file - ?php include_once('dal.php'); $storeID = $_POST['storeID']; //Get storeID from jQuery.post parameter $sl = new storeLocator(); $result = $sl-getStoreData($storeID); //returns dataset from MySQL (SELECT * from MyTale) while ($row = mysql_fetch_array($result)) { $data[] = array( id=($row['id']) , name=($row['name'])); } $storeData = json_encode($data); echo $storeData; ? Thanks for all your help guys!
[jQuery] Re: jQuery.post() not working for me
spstieng wrote: Ah, got it. The Post is correct and the Respons is correct... I think. It's in JSON, but not sure if it's correct. According to http://docs.jquery.com/Ajax/jQuery.post, last example, they have the following line in the php file: ?php echo json_encode(array(name=John,time=2pm)); ? This is why they can output the info by alert(data.name). But if I try this: while ($row = mysql_fetch_array($result)) { $data[] = array( id=($row['id']) , name=($row['name'])); } $storeData = json_encode($data); I still get 'undefined' output :( It seems that you will get multi row array with that php code. Try to fetch one row only, then store it with: $data['id'] = $row['id']; $data['name'] = $row['name']; $storeData = json_encode($data); You get undefined, because you try to alert an array. -- Donny Kurnia http://hantulab.blogspot.com http://www.plurk.com/user/donnykurnia
[jQuery] Re: Highlight a table row on radio button click
//Find all the check boxes in your table. $(#mytable :checkbox).click( function(){ // Set the currently selected item to be not selected. Comment out the following line if you meant the ability to select multiples. $(.selected).removeClass(selected); // Get the parent of the check box, this should be its containing TD, Then get the parent of that which should be the TR. $(this).parent() .parent().addclass(selected); } ) On Apr 16, 8:15 am, Raja Koduru kscr...@gmail.com wrote: Nitin, paste some code/snippets here. Will help us to help you. -raja On Thu, Apr 16, 2009 at 5:48 PM, Nitin Gautam gautam.ni...@gmail.com wrote: I have a table in which each row has radio botton in first td. I have to make a code so that when user click on radio button that row get highlighted . When click other that get highlighted and rest without highlight- Hide quoted text - - Show quoted text -
[jQuery] Re: recommendation for lightbox
iceangel89 wrote: what do u recommend for a lightbox plugin? there are alot out there I use thickbox (http://jquery.com/demo/thickbox/) and jqModal (http://dev.iceburg.net/jquery/jqModal/) in my projects. Haven;t tried other plugins, but I satisfied with both thickbox and jqModal. For alert replacement, try http://abeautifulsite.net/notebook/87 -- Donny Kurnia http://hantulab.blogspot.com http://www.plurk.com/user/donnykurnia
[jQuery] Re: How to pick out classes that start with a particular string.
cant you just get the className and then do a split on it with spaces as the deliminator? On Apr 16, 9:53 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: Both of those would work as solutions to this problem. However, I'd still really like to find out if there's a way to get a list (array?) of all of the classes that are currently attached to an element and loop through them. It doesn't dound like it should be so hard. Jon On Apr 16, 3:50 pm, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: I'm not really sure why you're not just doing this in pure css. .button { padding-right: 20px; background-position: center right; background-repeat: no-repeat;} .iconstar { background-image: url(star.png);} .iconplus { background-image: url(plus.png);} Am I missing something here? Jonathan David wrote: The problem I see is what happens when there is more than one class? Your icon call may not be the first class. in which case you would not have selected it. But it was still supposed to get an icon. Would it be possible to give the divs that are supposed to receive the icons a generic class then use an attribute to define what icons it is supposed to have. You could even reduce the amount of code that you have to output. div class=icon button img=Star/div $(.button).each(function(){ if ($(this).hasAttribute(img) $(this).attr(img) != ) { $(this).append(IMG SRC=' + $(this).attr(img) + .gif'); } ) I know that it is probably not the best code as you are using attibutes that do not fall into the dom standards but it looks like it would get the job done. On Apr 16, 8:51 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: Here is some psuedo-code for what I'm trying to achieve... $(.button).each(function(){ // Get an array of classes that are attached to $(this) // Loop through the array classes for (items in array){ // check to see if the class starts with icon if(className.startswith('icon')){ // remove the first 4 characters var iconName = className.substring(4, className.length); // Use the remainder to append the image $(this).append(IMG SRC=' + iconName + .gif'); } } }); That way, I could have hundreds of possible icons and I wouldn't have to have hundreds of IF statements and hundreds of calls to .hasClass() On Apr 16, 2:16 pm, MorningZ morni...@gmail.com wrote: Well, other than asking whether or not an object has a class or doesn't, there isn't much you can do that check each class name so like (and this assumes your original HTML, not the separated class name) : var icons = [Star, Plus, Left, Right, Up, Down]; $(div.button).each(function() { var $dv = $(this); $.each(icons, function() { if ($dv.hasClass(icon + this)) { $dv.append('img src=Images/' + this + '.gif alt= /'); return false; } }); }); On Apr 16, 9:08 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: - Show quoted text - -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be- Hide quoted text - - Show quoted text -
[jQuery] Re: $(button).Bind(click, function) Vs button onClick=function/
Andy Matthews wrote: Try disabling the button, then reenabling it with jQuery? -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of reach4thelasers Sent: Thursday, April 16, 2009 8:39 AM To: jQuery (English) Subject: [jQuery] $(button).Bind(click, function) Vs button onClick=function/ I know that the recommended usage in all the books/blogs/web sites is the bind() method in the $(document).ready(function() {} However I am finding that very often my users are taking action by clicking etc before the page has completely loading. This usually results in a full form postback instead of AJAX, or worse nothing happens at all. I understand that the bind method within the .ready function works best if the handler requires an element further down the page that may not have been loaded yet. But if I do not rely on anything further down the page, is there any good reason not to use the onClick= attribute, to wire-up my event handlers immediately rather than waiting for the full page to be loaded? Or, make it hidden with css, then show it using jquery. Consider to optimize your page, so it load faster. Use lazyload to load big images, trim out it's size, use compression, etc. Other approach, use google technique for gmail, all the element is loaded thought XMLHttpRequest, so there will be no premature click. -- Donny Kurnia http://hantulab.blogspot.com http://www.plurk.com/user/donnykurnia
[jQuery] Re: How to pick out classes that start with a particular string.
jonhobbs wrote: Both of those would work as solutions to this problem. However, I'd still really like to find out if there's a way to get a list (array?) of all of the classes that are currently attached to an element and loop through them. It doesn't dound like it should be so hard. Jon you could loop through all elements with $('.button'), and get their attr('class'), put those elements in an array, then parse that srting with a regex to see if you have a match. It can be done, but I just wouldn't recommend it. Use seperate classes like MorningZ suggested and you don't even need to use javascript if all you want to do is put an image in a class (that really is a job css was made for, javascript should just stick to the behavioural stuff). Jonathan -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be
[jQuery] Re: binding after .get()
hphoeksma wrote: Hi all, new to jQuery I am having difficulty on the binding concept. Currently using this function to regenerate a full form based on a PHP script. -- $(select).change(function () { $.get('script.php', {'c': c, 'sc': sc }, function(data) { $('form').html(data); }); return false; }) .change(); -- This works, but I'd like to use some next steps in the newly created selectors. I understand I need to (re)bind these selectors, but am lost on how to achieve that. Anyone? Thanks in advance, Henjo This is what work for me: 1. I write all the js code near the element that need it. In your case, I will write the jquery code soon after the /select tag. The code will be like this: select ... /select script type=text/javascript jquery(function($){ $(select).change(function(){ }); }); /script 2. When I do ajax that will replace the current DOM element, I will also send the code for the new element in the XMLHttpRequest response. In your case above, the script.php will return data to .get like this: . select ... /select script type=text/javascript jquery(function($){ $(select).change(function(){ }); }); /script .. With this approach, the injected data will bring all the needed code for it's element. I use this for form, list with pagination, and all other XMLHttpRequest. Writing js code near element that need it, beside maintain the unobtrusive, also made debugging it easier. I hope this will work with your case. -- Donny Kurnia http://hantulab.blogspot.com http://www.plurk.com/user/donnykurnia
[jQuery] Re: binding after .get()
Hi Donny, thanks for your reply. This will lead to lots of extra code I guess... Would there be another way? Thanks! Henjo On Apr 16, 5:14 pm, Donny Kurnia donnykur...@gmail.com wrote: hphoeksma wrote: Hi all, new to jQuery I am having difficulty on the binding concept. Currently using this function to regenerate a full form based on a PHP script. -- $(select).change(function () { $.get('script.php', {'c': c, 'sc': sc }, function(data) { $('form').html(data); }); return false; }) .change(); -- This works, but I'd like to use some next steps in the newly created selectors. I understand I need to (re)bind these selectors, but am lost on how to achieve that. Anyone? Thanks in advance, Henjo This is what work for me: 1. I write all the js code near the element that need it. In your case, I will write the jquery code soon after the /select tag. The code will be like this: select ... /select script type=text/javascript jquery(function($){ $(select).change(function(){ });}); /script 2. When I do ajax that will replace the current DOM element, I will also send the code for the new element in the XMLHttpRequest response. In your case above, the script.php will return data to .get like this: . select ... /select script type=text/javascript jquery(function($){ $(select).change(function(){ });}); /script .. With this approach, the injected data will bring all the needed code for it's element. I use this for form, list with pagination, and all other XMLHttpRequest. Writing js code near element that need it, beside maintain the unobtrusive, also made debugging it easier. I hope this will work with your case. -- Donny Kurniahttp://hantulab.blogspot.comhttp://www.plurk.com/user/donnykurnia
[jQuery] Re: Has anyone used these jQuery books?
Hey Karl, I was interested in this question also and read your great response. As one of the authors your thoughts hold a lot of weight for me. Thanks for the recommendation almost against your older book. This is what I love about this community. It's about the tools and the community users/customers whether it sells books or not. J Thanks! Matt Penner From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Karl Swedberg Sent: Wednesday, April 15, 2009 2:33 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Has anyone used these jQuery books? As one of the authors of jQuery Reference Guide, I'd have to recommend that you not buy it, especially if you already have Learning jQuery 1.3. Some of the information in the reference guide is outdated, and most of it can be found elsewhere. I still haven't gotten my hands on jQuery UI 1.6 (though a photo I took is on its cover), but you should know that a lot changed between 1.6 and 1.7. Also, 1.6 is compatible with jQuery 1.2.x, while 1.7 is compatible with 1.3.x, in case that matters. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 15, 2009, at 5:08 PM, Calvin wrote: Hi everybody, Has anyone here read/ used these books: jQuery UI 1.6 by Dan Wellman jQuery Reference Guide by Chaffer Swedberg I am wondering which one is better for learning how to make front-end interfaces for applications. p.s- Learning jQuery 1.3 is a awesome book!
[jQuery] get Ajax answer to test it
Hi everyone, I'm getting in trouble with ajax and jquery. Here is what i need: I want to execute a php script to test the value of an input. There is no problem with event and triggering the request. Here is my code : $.ajax({ url: 'emplacements/verifiernumero/numero/'+input.val(), success: function(responseText){ // on success callback alert(on a fait la rek+$.html(responseText)); }, error: function(responseText){ // on error callback }) the url is read thanks to zend_framework, which will take the parameter input.val the php script is rendering me something like : -if it'okay i get 1, else if get nothin If I executed the page 'emplacements/verifiernumero/numero/'+My_value I get 1 or nothingdepending of my tests.. well what I want to do is get the answer of the script, to test it how can we do this ? I read the documentation, but didn't found. Thankyou in advance for your help .
[jQuery] Re: ajax POST not working with IE7/8 ?
On IE8, I see the problem that GET Ajax requests default automatically to POST Ajax requests! Breaks my RESTful Rails app! Still hunting for a solution. On Mar 22, 9:37 pm, Wichert Akkerman wich...@wiggy.net wrote: I am doing anajaxform submit using Mike Alsup's form widget, but something appears broken on IE7 and IE8. Debugging inside jQuery 1.3.2'sajaxmethodI seen the following behaviour: - if s.data == _buttonfix=step2next=step2 onreadystatechange is never triggered, andIEdoes a normal (non-ajax) form submit - if s.data == null onreadystatechange is triggered, and normal processing continues the backend returns the exact same response for both situations. Does anyone have an idea what the problem might be? Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things.http://www.wiggy.net/ It is hard to make things simple.
[jQuery] Error messages is repeating !!
Hi , Frnds I had encountered a unusual problem in one of the forms I had validated through jQuery in my prjt. The error messages are getting repeated if I keep presing the submit button without entering any value. any the form gets as many error messages as many time I click the submit button . Any sugesstion will be a welcome Thanks Amit
[jQuery] cluetip IE8 very slow adding to table rows
Hi there, I've recently been using cluetip on a datable of about 400 rows. Recently I tested this against IE8 and found it very very slow. Doing simply the following: $(document).ready(function() { $(.user).each(function(i) { $(this).cluetip(); } }); Basically for each row in my table (400 rows) it would attach the cluetip to it. In IE8 it would freeze the browser for a good minute, if I pushed the compatibility mode button to run in IE7 mode it worked as expected. In all other browsers it worked perfectly. Is there something different going on with IE8? Thanks in advance DotnetShadow
[jQuery] Re: How to pick out classes that start with a particular string.
I will probably use seperate classes, but I found the answer. $(.button).each(function(el){ classStr = el.className; classes = classStr.split(' '); // Loop through classes and find the one that starts with icon }); On Apr 16, 4:05 pm, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: jonhobbs wrote: Both of those would work as solutions to this problem. However, I'd still really like to find out if there's a way to get a list (array?) of all of the classes that are currently attached to an element and loop through them. It doesn't dound like it should be so hard. Jon you could loop through all elements with $('.button'), and get their attr('class'), put those elements in an array, then parse that srting with a regex to see if you have a match. It can be done, but I just wouldn't recommend it. Use seperate classes like MorningZ suggested and you don't even need to use javascript if all you want to do is put an image in a class (that really is a job css was made for, javascript should just stick to the behavioural stuff). Jonathan -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be
[jQuery] Re: binding after .get()
hphoeksma wrote: Hi Donny, thanks for your reply. This will lead to lots of extra code I guess... Would there be another way? Thanks! Henjo What important is re-bind all code to new element that loaded throught ajax request. One way to do it is put the needed js code in the returned response, so it's get inserted and executed with the new elements. The step 1 in my solution is my practice. If it lead to a lot code rewriting, don't do it for all element, but to the element that got returned from ajax request. On Apr 16, 5:14 pm, Donny Kurnia donnykur...@gmail.com wrote: hphoeksma wrote: Hi all, new to jQuery I am having difficulty on the binding concept. Currently using this function to regenerate a full form based on a PHP script. -- $(select).change(function () { $.get('script.php', {'c': c, 'sc': sc }, function(data) { $('form').html(data); }); return false; }) .change(); -- This works, but I'd like to use some next steps in the newly created selectors. I understand I need to (re)bind these selectors, but am lost on how to achieve that. Anyone? Thanks in advance, Henjo This is what work for me: 1. I write all the js code near the element that need it. In your case, I will write the jquery code soon after the /select tag. The code will be like this: select ... /select script type=text/javascript jquery(function($){ $(select).change(function(){ });}); /script 2. When I do ajax that will replace the current DOM element, I will also send the code for the new element in the XMLHttpRequest response. In your case above, the script.php will return data to .get like this: . select ... /select script type=text/javascript jquery(function($){ $(select).change(function(){ });}); /script .. With this approach, the injected data will bring all the needed code for it's element. I use this for form, list with pagination, and all other XMLHttpRequest. Writing js code near element that need it, beside maintain the unobtrusive, also made debugging it easier. I hope this will work with your case. -- Donny Kurniahttp://hantulab.blogspot.comhttp://www.plurk.com/user/donnykurnia -- Donny Kurnia http://hantulab.blogspot.com http://www.plurk.com/user/donnykurnia
[jQuery] Re: how can I delete all elements: children and parent
But won't work if the parent element contains other elements. Why not just use .remove() on the span? Btw, an ID that is a number (or starts with a number) is invalid. On Apr 16, 6:21 am, Raja Koduru kscr...@gmail.com wrote: $(#57).parent().empty() could work. check here:http://docs.jquery.com/Manipulation On Thu, Apr 16, 2009 at 6:01 PM, dziobacz aaabbbcccda...@gmail.com wrote: I have: span id='57' bla bla bla br/ a href='#' something1 /abr/ a href='#' onclick='clickk(57); return false;' DELETE /a br/br/ /span How can I delete span element with id=57 and also everything inside ?
[jQuery] .navButtonAdd Quick Question...
Hi there - I'm adding a custom button using the .navButtonAdd function. I see that there is an option for an image, but I'm wondering if I can create a button and apply a class instead. I have a toggle button that I'm adding and the image will change with the toggle state. Is this possible? Thanks!
[jQuery] Re: Menu Hover and Selected
I'm afraid you will have to eat your shoe, it doesn't work. :-(( http://www.njwebdesign.co.za/ victorg84 wrote: Small correction.. var activePage = window.location.pathname.substr(1); $(a[href=+activePage+] img).trigger(mouseover); -- View this message in context: http://www.nabble.com/Menu-Hover-and-Selected-tp22999583s27240p23081451.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: hover problems
the technique here might be of interest: http://www.ihwy.com/Labs/demos/Current/image-hover-menu.aspx - Jack Rick Faircloth wrote: Check out the Hover Intent plugin here: http://cherne.net/brian/resources/jquery.hoverIntent.html I think it's just what you're looking for. Rick On Thu, Apr 16, 2009 at 12:28 AM, 3daysaside 3daysas...@gmail.com mailto:3daysas...@gmail.com wrote: Been searching for the last hour, found some solutions, but still not good enough. I have a navigation menu -- when I hover over a header, I want the submenus to slideDown, and then on hoverOut, I want it to slide back in. First, I was having problems with it only displaying 2 or 3 of the dropdown items if I got crazy with the hovering (on, off, on, off quite rapidly). Then I found the .css(overflow:visible) fix. That causes the menu to at least always display all the items, but the effect is lost if you hover on/off quickly. What am I missing? This can't be this hard. Here's the link: http://www.threedaysaside.com/cep Javascript: $(document).ready(function() { $(.sub_div).hide(); /*$(.sub_div).css('opacity', 0.9);*/ $(.subnav_a).hover(function() { $(.sub_div).stop().css('overflow', 'visible').slideDown(800); }, function() { $(.sub_div).stop().css('overflow', 'visible').slideUp(300); }); }); The Residential link is the only one with a dropdown. And don't worry about the styling, I haven't even had a chance to worry about it myself yet. -- - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson
[jQuery] Re: CTRL+S to Insert Record PHP+JQUERY
As far as I know you can't capture key combinations in Javascript, and even if you could, CTRL+S is a browser shortcut, so it would probably be overriden. On Apr 16, 2:24 am, bharani kumar bharanikumariyer...@gmail.com wrote: Hi All , Can u please tell , How to implement in jquery, php,, Insert record after pressed the CTRL+S in keyboard , Thanks -- உங்கள் நண்பன் பரணி குமார் Regards B.S.Bharanikumar POST YOUR OPINIONhttp://bharanikumariyerphp.site88.net/bharanikumar/
[jQuery] Re: How to pick out classes that start with a particular string.
Short answer: $(.button).each(function(){ var icon = /icon(\w+)/.exec(this.className)[1].toLowerCase(); $(this).append('img src=images/' + icon + '.gif /'); }); - ricardo On Apr 16, 9:58 am, jonhobbs jon.hobbs.sm...@gmail.com wrote: This might be hard to explain, but I need a way to loop through a bunch of elements I've already selected and for each one find classes that start with the word icon. So for example I might have the following elements div class=button iconStar/div div class=button iconPlus/div div class=button iconLeft/div div class=button iconRight/div div class=button iconUp/div div class=button iconDown/div So, I begin by selecting the elements and looping through them $(.button).each(function(){ // Some code here }); Now, I could put the following code in the loop... if ($(this).hasClass(iconStar)){ $(this).append(IMG SRC='Images/star.gif'); } I would then have to repeat that for each possible icon, which seems very inefficient. What I'd like to do in the each loop is just cycle through all the classes that $(this) has and pick out the one that begins with ICON and then use that to append the image. Can anyone help?
[jQuery] Creating an ajax status
I have a number of GET and POST ajax calls that do various things my script. For each one, I would like to set a status that is a string, so that I can out put that to the user. So, it might look like this: Ajax POST Posting to page Ajax GET Getting content page Ajax POST Sending data to page Basically I want to set the status using something like $ ('#status_div').text(); so that the user will see the status text when each ajax function is run. Does anyone have ideas on how this could be accomplished?
[jQuery] Re: Creating custom attributes in html
Josh, I have to agree with Rob on the class thing. It's really not meant specifically for presentation, it just happens to be one of the most practical (and fully supported) selectors in CSS. There's no problem in using jquery.metadata to store data in it, it's valid HTML (yes, quirks mode can cause trouble, specially as your page gets more complex. valid mark-up is a safety measure) and offers good enough performance. Although I also agree with Rob that, if you already have your data in an object coming through Ajax, there's no need to parse it and throw it in the DOM just to recover it later. A simple reference to the element would be enough, and you can identify it with the ID attribute, sharing the object's unique id (if there is one). cheers, - ricardo On Apr 16, 6:53 am, Josh Powell seas...@gmail.com wrote: @all - So far, the only reasons I've heard not to add custom attributes are 1) Dogma, 2) May cause quirks mode. In my mind, the benefits gained by using custom attributes: less code, simplicity, and clarity, far outweigh these two reasons not to do it. @Jack K - Thanks for the links :). I will consider adding 'data-' to future custom attributes. But, I actually don't really care if my html code is a valid document. Being a valid document has no practical meaning, all browsers render it just fine regardless of if it is valid or not. @RobG - I was being careless with my use of the words 'attribute' and 'properties', but did you really need to correct me 4 times, and then correct my use of override to overload twice? I guess you did. The class attribute might not have the words 'presentation' and 'style' in the W3C definition, but if you tell me that the class attribute is not meant primarily for styling DOM elements, I'm just going to ignore everything else you say as you are just being argumentative. So you've already got the data in an object, now you added it as custom HTML attributes, then suck it back out again using attr(). Can you see the silliness inherent in the system? Actually, I think it is less silly then appending an id onto the end of the attribute id and then parsing it to obtain the id of the object I'm looking for, and then creating a custom object with get/set methods to retrieve the appropriate object to get its properties. Why not make the media object a bit smarter than just an array, say with set and get methods? Because that is unnecessary code. It's code I do not need to write if I just add custom attributes. @Kean -http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-cor... To sum up: - string concatenation is plenty fast 99% of the time and a lot more readable. - W3C DOM Node creation is much slower then inserting via innerHTML, especially as you add more nodes. It doesn't matter how fast the nodes are created, it will always be slower to create, adjust, and insert 10,000 nodes then one string.
[jQuery] Re: Creating an ajax status
$.ajax supports an option called beforeSend so it would be something like: $.ajax({ type:POST, url:some.php, data:name=Johnlocation=Boston, success:function(msg){ alert(Data Saved: +msg); } beforeSend:function() { alert(Sending request to server'); } }); I am assuming you are using $.ajax because you are probably using the same page with either GET or POST. -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Nic Hubbard Sent: Thursday, April 16, 2009 11:31 AM To: jQuery (English) Subject: [jQuery] Creating an ajax status I have a number of GET and POST ajax calls that do various things my script. For each one, I would like to set a status that is a string, so that I can out put that to the user. So, it might look like this: Ajax POST Posting to page Ajax GET Getting content page Ajax POST Sending data to page Basically I want to set the status using something like $ ('#status_div').text(); so that the user will see the status text when each ajax function is run. Does anyone have ideas on how this could be accomplished?