[jQuery] Re: Media Plugin (malsup site) REPLACE code uses OLD metadata.js - ALSO: nothing works in IE6/IE7
SORRY for not getting to this point in less posts: So... turns out the functionally metadata version 1.0 AND the version that's close to this are the same enough as on FF and Opera my markup AND the 'replace' code example script WORK. I have added to the top of the replace example script a couple of lines so that it will: 1) work with my flv player and 2) call all the flashvars I need WHICH includes the flv to actually play. 3) my html also have flashvar calls... I figure that something about my markup and the stuff I added to the top of the replace code is causing some weirdness. THOUGH WHY does it work in FF and opera WITH the version 1.0 metadata...??? I AM running the latest JQuery 1.2.6 ... againall good fun...truly! So, back to the testing station ANY thoughts welcomed, of course!
[jQuery] Re: event.preventDefault() not in the intellisense?
Hmm, sounds like a visual studio bug. Usually you just return false instead of doing e.preventDefault() when coding with jQuery. i.e. $('a').click(function(){ alert('clicked'); return false; // prevent default }); On Jan 3, 7:54 pm, yww yww...@gmail.com wrote: Hi I am new to this group and also new to Jquery. So I am just trying the sample in tutorials. Basically it works very nicely. But there is a small flaw while I was playing with JQuery, that I can't get the intellisnse help from visual studio. and I have captured the screen shot as following: http://picasaweb.google.com/lh/photo/i6GxK88a7vxrQR9qS8BARQ?feat=dire... so you see I have add reference to jquery-1.2.6-vsdoc.js, but there is no preventDefault() method for event object. What should I do to enable that? by the way, although the method was not listed, it can be used correctly and really prevented the click event.
[jQuery] Re: Absolute Image location
On Sat, Jan 3, 2009 at 9:54 PM, MarkAtHarvest m...@harvestinfotech.com wrote: Brian, Here is the html code on my http://localhost:8080/mytrial/admin.gsp, on my grails application. Just added this to find the absolute location for the images if I use div class=images images/down.gif image /div this goes to link, http://localhost:8080/mytrial/images/down.gif, and it does not find it. and if I change this to div class=images /images/down.gif image /div this goes to link http://localhost:8080/images/down.gif, its going to root intead of going to http://localhost:8080/mytrial/images/down.gif I haven't a clue. Neither do I understand why you'd be creating img tags in that way. My JSP days were long ago (it seems) and I've never even looked at grails. Why don't you just use an img tag?
[jQuery] How is it possible to have click on each 'a href' menu item and ALSO have another 'a href' trigger as well?
Hi... ALL the following occurs on ONE page of markup with ONE css file. [OBJECTIVE: when I click on my menu items I need another 'a href' to ALSO trigger it's link event. I COULD put the second set of link somewhere visible out of the way, though I just need them to be invoked, one for one for each of the menu items. So: have menu with 12 items and when each item is clicked need one of each of the second set of basic 'a href' link to happens also. One to one relationship. 12 seperate menu items for 12 seperate set of anchors items. I have a basic menu with a whole bunch of lis like this and it works fine: lia href=#firstname of menu item/a/li The '#first' triggers a bunch of moves as does each menu item. So each menu has different a different # name. I don't know how irrelevant this might be. Secondly I have a bunch of anchors I think they're called.: a href=vid4.flvWatch my movie!/a I want these to happen when the first set of lis are clicked. I can add unique class, name id to them though I don't know what might be best. ??? thank you!
[jQuery] [treeview] Feature proposal
Hello. I would like to propose a new feature for the Treeview plugin. persist: 'location+cookie' This would use both location.href and cookies for persistance. First, the plugin searches the list for location.href. If found - opens the proper node, saves a new cookie and finishes. If not found - then opens the node that was saved in the cookie. This would give a power. Let's have an internet bookshop. We have got a category browser on the left (Treeview) with all categories. The user searches the list for the category and then clicks a link. Now the first page of category products has been shown. The user finds the book he wants to buy and clicks on it. The book url does not exist in a treeview list, so persist: location will fail to open the valid node. persist: cookie works for now - the correct node has been open. Now the user clicks go back button as many times as it is needed to go back to homepage. The result is that some nodes are open but should not be. persist: cookie fails to open the correct node. In this case persist: location would give positive results. As you can see a hybrid of location and cookie would make this more flexible. Greetings, Damian Nowak www.nowaker.net
[jQuery] Time since last event?
I'm working on spicing up a search bar so it loads the results through an ajax call. I throws the request whenever a keyup event has been fired in the input field, my code looks like this: inputValue = jQuery(input#s).val(); url = http://www.iconpark.net/?s=; + inputValue + #content *; jQuery(#content).slideUp(800, function() { jQuery(#content).load(url,{},function() { jQuery(#content).slideDown(500, function() { jQuery('p:contains('+inputValue+')').each(function(){ jQuery(this).html(jQuery(this).html().replace(new RegExp (inputValue,'g'), 'span class=highlighted'+inputValue+'/span')); }); }); jQuery.getScript(http://www.iconpark.net/wp-content/themes/ PixelResort/javascript/myScripts.js); }); }); I works fine, it wraps the search results with span class=highlighted/span, however, at the moment it creaets as many span tags as key-up events so I'm wondering if there is a to calculate the time that has elapsed since last key-up event so I could call the jQuery code that hightlights the search results only when a second has passed since last kep-up event?
[jQuery] How to enable intellisence for Jquery in zend studio for eclipse
Im new to javascript and also with JQuery and i need to see functions and objects in Intellisence (auto completion) feature of zend studio. is there any way to make Zend studio to show functions and object of JQuery? i tried to add library (in user library option) in project properties and it just show them in PHP explorer but nothing appear when i try Ctrl+Space in my code. i saw ZS support Dojo nicely and i though maybe it can support JQuery in same way. thanks for support. regards.
[jQuery] Re: questions on event delegation
Thanks Brian for your help most of the help that I've found at other places was kinda sketchy at best or was use livequery, Livequery is a nice tool for most situations but when you start attaching events to hundreds of objects it will slow a page right to a crawl which is why I was looking into event handeling IE rebinding and event delegation event delegation means probably less coding and faster loading I'm told but with a good explination of how to rebind objects manualy I'm sure I can manage from there too I don't understand the question. What object? The anchor *inside* the div? You could use find('a') on the event target (the div) and check the className. Being an self taught old school C coder I thought it would be easier to migrate to PHP but I cant really complain other than my termanology yes thats exactly correct the anchor inside the div just curious would this after reloading the content div without binding will this find any anchor elements loaded inside the div and report them to the alert box note I removed the 'li' from parent() $('#content a').click(function(event) { alert($(this).parent().attr('id')); event.preventDefault(); }); if it works I could use a select to execute the correct script oh I cant wait to get home its my weekend this weekend... even if that doesn't I'm pretty sure that removing that anchor that was loaded in the new content would allow it to return the id of the parent of a clicked object ... $('#content').click(function(event) { alert($(this).parent().attr('id')); event.preventDefault(); }); and if that dosent I'm sure that thiere is information in the link to help me with binding ... Thanks a lot Brian you have but a lot of pep back in my step ... I just have to watch out for those ceiling fans for an hr or 2 talk to ya later John On Jan 3, 8:10 pm, brian bally.z...@gmail.com wrote: On Sat, Jan 3, 2009 at 8:06 PM, brian bally.z...@gmail.com wrote: On Sat, Jan 3, 2009 at 4:36 PM, holandmij...@gmail.com wrote: My question's are 1. If you have a Div class= content with children anchors. Then empty and load in new content in that div with children anchor those anchors will get the same event handling that the previous anchors had right? No (well, not exactly). Any click handlers you set on elements in that div will not be bound to anything if you remove the content. This is precisely what liveQuery deals with. It watches for new elements which match the selectors given earlier for bind event handlers. Sorry, I meant to add this link to the docs, which gives the lowdown on this (most) frequently asked question: http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st...
[jQuery] Re: How to handle responses from PHP with $.ajax()
Hi, Many thanks for the help. I had a go at implementing what you suggested but I'm clearly still missing something. Here is my $.ajax() call: -- $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php, data: email=+ email, success: function(del){ if(del.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); -- And here is my json array in PHP: -- $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); $json_data = array('result' = 1). } else { $json_data = array('result' = 0, 'error' = 'This is an error'). } json_encode($json_data); -- I'm obviously not accessing del.result correctly because $ ('div.error').show(); is always executed regardless of the value of result. Where am I going wrong? Thanks in advance, Rob. On Jan 4, 2:41 pm, donb falconwatc...@comcast.net wrote: Return a JSON object. Construct a PHP array such as $json_data = array('result' = 0, 'error' = 'This is an error'). End your PHP script with json_encode ($json_data). Then you can reference del.result and del.error (I'm referring to your definition of the' success' function from your sample code) On Jan 4, 7:16 am, rob303 r...@cube33.com wrote: Hi, I'm new to ajax and jquery but I'm not new to PHP. The following example seems to work okay to a point but I can't figure out how to handle data validation errors generated in my PHP. In my example I want to post some data to a script called ajax.php. That script will check the data for validity and then return true or false depending on the outcome of the checks. It will also set an appropriate error message. How can I handle the returned data and display an error message if needed in ajax? -- HTML / Ajax - test.php -- ?php require_once(includes.php); ? html head script src=js/jquery.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php, data: email=+ email, success: function(del){ $('form#submit').hide(); $('div.success').fadeIn('medium'); // what if the data failed validation in PHP? // we need to show 'div.error. } }); return false; }); }); /script /head body form id=submit method=post Email: input id=email class=text name=email size=20 type=text / input type=submit value=send mail / /form div class=success style=display:none; Email sent. /div div class=error ?php echo $userError; ? /div /body /html -- PHP - ajax.php -- ?php require_once(includes.php); $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); return 1;} else { $userError = Please enter your email address; return 0; } ? I've been searching the web for an answer but can't find one anywhere! Any help would be greatly appreciated.
[jQuery] Re: Call object method onclick
this worked for me: http://jsbin.com/utahi On Sun, Jan 4, 2009 at 5:31 PM, fatslags2...@gmail.com fatslags2...@googlemail.com wrote: function Viewer() { }; Viewer.prototype.constructor = Viewer; Viewer.prototype = { getFullAreaId: function() { return this._fullAreaId; }, setFullAreaId: function(fullAreaId) { this._fullAreaId = fullAreaId; }, initialize: function() { $(#thumbs img:first).click(/* execute this.doX on mouse click */); }, doX: function() { alert(this.getFullAreaId()); } }; How can I make the click event execute the doX method? Regards, FatSlags2004
[jQuery] Re: How to handle responses from PHP with $.ajax()
You must 'echo' the JSON output. Also you indicate periods ending code lines, instead of semicolons but perhaps that's just an error in your post, not the actual code? On Jan 4, 10:38 am, rob303 r...@cube33.com wrote: Hi, Many thanks for the help. I had a go at implementing what you suggested but I'm clearly still missing something. Here is my $.ajax() call: -- $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php, data: email=+ email, success: function(del){ if(del.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); -- And here is my json array in PHP: -- $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); $json_data = array('result' = 1).} else { $json_data = array('result' = 0, 'error' = 'This is an error'). } json_encode($json_data); -- I'm obviously not accessing del.result correctly because $ ('div.error').show(); is always executed regardless of the value of result. Where am I going wrong? Thanks in advance, Rob. On Jan 4, 2:41 pm, donb falconwatc...@comcast.net wrote: Return a JSON object. Construct a PHP array such as $json_data = array('result' = 0, 'error' = 'This is an error'). End your PHP script with json_encode ($json_data). Then you can reference del.result and del.error (I'm referring to your definition of the' success' function from your sample code) On Jan 4, 7:16 am, rob303 r...@cube33.com wrote: Hi, I'm new to ajax and jquery but I'm not new to PHP. The following example seems to work okay to a point but I can't figure out how to handle data validation errors generated in my PHP. In my example I want to post some data to a script called ajax.php. That script will check the data for validity and then return true or false depending on the outcome of the checks. It will also set an appropriate error message. How can I handle the returned data and display an error message if needed in ajax? -- HTML / Ajax - test.php -- ?php require_once(includes.php); ? html head script src=js/jquery.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php, data: email=+ email, success: function(del){ $('form#submit').hide(); $('div.success').fadeIn('medium'); // what if the data failed validation in PHP? // we need to show 'div.error. } }); return false; }); }); /script /head body form id=submit method=post Email: input id=email class=text name=email size=20 type=text / input type=submit value=send mail / /form div class=success style=display:none; Email sent. /div div class=error ?php echo $userError; ? /div /body /html -- PHP - ajax.php -- ?php require_once(includes.php); $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); return 1;} else { $userError = Please enter your email address; return 0; } ? I've been searching the web for an answer but can't find one anywhere! Any help would be greatly appreciated.
[jQuery] Call object method onclick
function Viewer() { }; Viewer.prototype.constructor = Viewer; Viewer.prototype = { getFullAreaId: function() { return this._fullAreaId; }, setFullAreaId: function(fullAreaId) { this._fullAreaId = fullAreaId; }, initialize: function() { $(#thumbs img:first).click(/* execute this.doX on mouse click */); }, doX: function() { alert(this.getFullAreaId()); } }; How can I make the click event execute the doX method? Regards, FatSlags2004
[jQuery] Re: How to handle responses from PHP with $.ajax()
Yes, the missing semicolons are an error in the post. I tried to echo the json_encode() call but I still can't get it to work. If I leave the email input blank no email is sent. If I enter a string the email is sent. The 'div.error' is always displayed regardless what's posted. Here's my full code again: -- HTML / Ajax -- ?php require_once(../inc/site_config.php); require_once(SITE . /includes.php); ? html head script src=js/jquery.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php?v=1, data: email=+ email, success: function(res){ if(res.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); /script /head body form id=submit method=post Email: input id=email class=text name=email size=20 type=text / input type=submit value=send mail / /form div class=success style=display:none; Email sent. /div div class=error style=display:none;err/div /body /html -- PHP -- ?php require_once(includes.php); $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); $json_data = array('result' = 1); } else { $json_data = array('result' = 0); } echo json_encode($json_data); ? $message = $_POST['email']; if($message != '') { mail('r...@cube33.com', 'Ajax test', $message); $json_data = array('result' = 1); } else { $json_data = array('result' = 0); } echo json_encode($json_data); ? -- On Jan 4, 5:44 pm, donb falconwatc...@comcast.net wrote: You must 'echo' the JSON output. Also you indicate periods ending code lines, instead of semicolons but perhaps that's just an error in your post, not the actual code? On Jan 4, 10:38 am, rob303 r...@cube33.com wrote: Hi, Many thanks for the help. I had a go at implementing what you suggested but I'm clearly still missing something. Here is my $.ajax() call: -- $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php, data: email=+ email, success: function(del){ if(del.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); -- And here is my json array in PHP: -- $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); $json_data = array('result' = 1).} else { $json_data = array('result' = 0, 'error' = 'This is an error'). } json_encode($json_data); -- I'm obviously not accessing del.result correctly because $ ('div.error').show(); is always executed regardless of the value of result. Where am I going wrong? Thanks in advance, Rob. On Jan 4, 2:41 pm, donb falconwatc...@comcast.net wrote: Return a JSON object. Construct a PHP array such as $json_data = array('result' = 0, 'error' = 'This is an error'). End your PHP script with json_encode ($json_data). Then you can reference del.result and del.error (I'm referring to your definition of the' success' function from your sample code) On Jan 4, 7:16 am, rob303 r...@cube33.com wrote: Hi, I'm new to ajax and jquery but I'm not new to PHP. The following example seems to work okay to a point but I can't figure out how to handle data validation errors generated in my PHP. In my example I want to post some data to a script called ajax.php. That script will check the data for validity and then return true or false depending on the outcome of the checks. It will also set an appropriate error message. How can I handle the returned data and display an error message if needed in ajax? -- HTML / Ajax - test.php -- ?php require_once(includes.php); ? html head script src=js/jquery.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url:
[jQuery] Re: Call object method onclick
Hmm, I don't think you should do this: Viewer = new Viewer; this will overwrite your class and you can't instantiate it again! rather: initialize: function() { var self=this; $(#thumbs img:first).click(function(){ self.doX() }); }, or initialize: function() { var self=this; $(#thumbs img:first).click(function(){ var el=this; //this is the element here (function(){ this.doX(); //this refers to your object here $(el).something(); }).call(self); }); }, On Jan 4, 5:57 pm, Alexandre Plennevaux aplennev...@gmail.com wrote: this worked for me:http://jsbin.com/utahi On Sun, Jan 4, 2009 at 5:31 PM, fatslags2...@gmail.com fatslags2...@googlemail.com wrote: function Viewer() { }; Viewer.prototype.constructor = Viewer; Viewer.prototype = { getFullAreaId: function() { return this._fullAreaId; }, setFullAreaId: function(fullAreaId) { this._fullAreaId = fullAreaId; }, initialize: function() { $(#thumbs img:first).click(/* execute this.doX on mouse click */); }, doX: function() { alert(this.getFullAreaId()); } }; How can I make the click event execute the doX method? Regards, FatSlags2004
[jQuery] Re: How to handle responses from PHP with $.ajax()
Interestingly, in the Firebug console I'm seeing the correct responses: {result:1} or {result:0} How can I access these inside my $.ajax() call? Many thanks again for all the help! Rob. On Jan 4, 5:57 pm, rob303 r...@cube33.com wrote: Yes, the missing semicolons are an error in the post. I tried to echo the json_encode() call but I still can't get it to work. If I leave the email input blank no email is sent. If I enter a string the email is sent. The 'div.error' is always displayed regardless what's posted. Here's my full code again: -- HTML / Ajax -- ?php require_once(../inc/site_config.php); require_once(SITE . /includes.php); ? html head script src=js/jquery.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php?v=1, data: email=+ email, success: function(res){ if(res.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); /script /head body form id=submit method=post Email: input id=email class=text name=email size=20 type=text / input type=submit value=send mail / /form div class=success style=display:none; Email sent. /div div class=error style=display:none;err/div /body /html -- PHP -- ?php require_once(includes.php); $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); $json_data = array('result' = 1);} else { $json_data = array('result' = 0); } echo json_encode($json_data); ? $message = $_POST['email']; if($message != '') { mail('@cube33.com', 'Ajax test', $message); $json_data = array('result' = 1);} else { $json_data = array('result' = 0); } echo json_encode($json_data); ? -- On Jan 4, 5:44 pm, donb falconwatc...@comcast.net wrote: You must 'echo' the JSON output. Also you indicate periods ending code lines, instead of semicolons but perhaps that's just an error in your post, not the actual code? On Jan 4, 10:38 am, rob303 r...@cube33.com wrote: Hi, Many thanks for the help. I had a go at implementing what you suggested but I'm clearly still missing something. Here is my $.ajax() call: -- $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php, data: email=+ email, success: function(del){ if(del.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); -- And here is my json array in PHP: -- $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); $json_data = array('result' = 1).} else { $json_data = array('result' = 0, 'error' = 'This is an error'). } json_encode($json_data); -- I'm obviously not accessing del.result correctly because $ ('div.error').show(); is always executed regardless of the value of result. Where am I going wrong? Thanks in advance, Rob. On Jan 4, 2:41 pm, donb falconwatc...@comcast.net wrote: Return a JSON object. Construct a PHP array such as $json_data = array('result' = 0, 'error' = 'This is an error'). End your PHP script with json_encode ($json_data). Then you can reference del.result and del.error (I'm referring to your definition of the' success' function from your sample code) On Jan 4, 7:16 am, rob303 r...@cube33.com wrote: Hi, I'm new to ajax and jquery but I'm not new to PHP. The following example seems to work okay to a point but I can't figure out how to handle data validation errors generated in my PHP. In my example I want to post some data to a script called ajax.php. That script will check the data for validity and then return true or false depending on the outcome of the checks. It will also set an appropriate error message. How can I handle the returned data and display an error message if needed in ajax? -- HTML / Ajax - test.php --
[jQuery] Re: How to check all required fields after each field is filled...
This works, but is not terribly usable as it throws an alert every after every failed scan, but you can easily modify the method to make it more usable, or even simply remove the alert and the button will remain disabled until all required fields are filled in. It could be optimized a bit, but for clarity it's a bit verbose. Copy and paste this into a new .html file and load in your browser. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en-us lang=en dir=ltr head script type=text/javascript src=http://ajax.googleapis.com/ ajax/libs/jquery/1.2.6/jquery.js /script script type=text/javascript $(function(){ // Cached the wrapped set. $req = $('input.required'); // A flag for scan results. $.reqFlag = { pass: null, failMethod: function(){ alert('Please Fill In All Required Fields'); }, passMethod: function(){ $('#submitButton').attr('disabled',false); } } // Scan method. $.scan = function(){ $req.each(function(){ !$(this).val() ? $.reqFlag.pass = false : $.reqFlag.pass = true; }) !$.reqFlag.pass ? $.reqFlag.failMethod() : $.reqFlag.passMethod(); } $req.each(function(){ $(this).blur(function(){ $.scan() }); }); }); /script /head body form action= input class='required' name=one type=text / br / input class='required' name=two type=text / br / input class='required' name=three type=text / br / input class='required' name=four type=text / br / input type='submit' value='go' id=submitButton disabled=true / /form /body /html On Jan 3, 9:58 pm, Rick Faircloth r...@whitestonemedia.com wrote: Thanks for the reply, Joe... To answer your question: I want to check the required fields for any that are still invalid after a user blurs out of any required field. Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Joe Sent: Saturday, January 03, 2009 10:15 PM To: jQuery (English) Subject: [jQuery] Re: How to check all required fields after each field is filled... However, I want to be able to scan all required fields after each field is filled in and see if any required fields remain to be satisfactorily completed. When do you want to scan? After the user blurs out of the last input? Or blurs out of any required input (because technically the user could skip around on the form)? You obviously can't do it on submit because the button is disabled. I have an idea of how to do it, but you need to dictate the event handler that is going to do trigger the scanning. Joe http://www.subprint.com On Jan 3, 6:17 pm, Rick Faircloth r...@whitestonemedia.com wrote: Anyone? I'm trying to validate a form. All the validation I've implemented up to this point is working fine. However, I want to be able to scan all required fields after each field is filled in and see if any required fields remain to be satisfactorily completed. If there are any, I want to keep the submit button on my form disabled. I'm trying to use this code: $(':input.required').each(function() { var val = (this.value.length); if (val == 0) { $('#submit').attr('disabled', 'disabled'); }; }); However, each time I fill in a required field, the submit button is enabled. (I realize for now that the code above is only checking length and I can add other checks later, but wanted to get this one working first. Any clues? Thanks, Rick
[jQuery] Re: checkboxes, array and $.post
$(':submit').click(function(){ var serial = $('form').serialize(); var subVal = $('#submitButton').val(); var param = $('#submitButton').attr('name'); var data = serial + subVal + param; $.post(delete.php, data, function(){ ... }); }); That should do it. Joe http://www.subprint.com On Jan 2, 3:15 am, jjshell blahblahcoui...@gmail.com wrote: You rock Ricardo! :) Thank you very much. Just one last question. The submit button (#submitButton) doesn't seem to be serialized along with other fields... And I need its value. How would you add it to the post collection? Regards, -jj. On 1 jan, 22:03, Ricardo Tomasi ricardob...@gmail.com wrote: That's what serialize() is for: $(':submit').click(function(){ var data = $(this).parents('form:first').serialize(); // or $('#formID').serialize(); $.post(delete.php, data, function(){ ... }); }); On Jan 1, 8:48 am, jjshell blahblahcoui...@gmail.com wrote: Hi Ricardo, thanks for your reply. I think I must be missing something when it comes to $.post a form in jQuery. It seems too complicated to have to do something like this: $.post(delete.php,{ field1: $(#field1).val(), field2: $(#field2).val(), field3: $(#field3).val(), field4: $(#field4).val(), } Isn't there a way to simply post the whole form, with the whole post collection, to the specified url, without having to specify which field should be collected? That would make dealing with checkboxes much easier... Here's a sample form. How would you submit it? form name=test id=test method=post action=script.php input type=text name=field1 id=field1 value= / input type=text name=field2 id=field2 value= / input type=text name=field3 id=field3 value= / input type=text name=field4 id=field4 value= / input type=checkbox name=city[] class=cities value=1 / input type=checkbox name=city[] class=cities value=2 / input type=checkbox name=city[] class=cities value=3 / input type=checkbox name=city[] class=cities value=4 / input type=checkbox name=city[] class=cities value=5 / Regards, -jj. On 31 déc 2008, 22:56, Ricardo Tomasi ricardob...@gmail.com wrote: Assuming you have unique names: var CheckedIDs = []; $(input.items_id).livequery('click',function(event){ $(input.items_id).each(function() { if (this.checked) { CheckedIDs[this.name] = $(this).attr (value); } else { CheckedIDs[this.name] = null } }); }); Why do you need to store them in an array anyway? The checked ones values will be submitted with the form, and you can access them at anytime with $(:checkbox:checked) On Dec 31, 3:52 pm, jjshell blahblahcoui...@gmail.com wrote: Ok I'm getting closer... And thanks again for your help :) I can manage to have the checked checkboxes added to the CheckedIDs array. However, if I uncheck a checkbox, it is not removed from the array. It's the last little problem I have to solve :) Here's my code: var CheckedIDs = []; $(input.items_id).livequery('click',function(event){ $(input.items_id).each(function() { if(this.checked){CheckedIDs.push($(this).attr(value));} }); //alert('clicked'); }); On 31 déc, 17:33, Joe joseph.is...@gmail.com wrote: I don't believe you are using livequery in the proper way. You're passing an 'each' event, which does not exist here. In theory, you could do the following: $(input.item_id).livequery('foo',function(bar) { alert('nothing happens'); }); In the console, you will see the length of the wrapped set, the number of inputs with class item_id. Check the API again: http://brandonaaron.net/docs/livequery/#api Also, $.each method is similar to a for-loop: http://docs.jquery.com/Core/each That's a start for sure... Cheers. Joe http://www.subprint.com On Dec 31, 9:39 am, jjshell blahblahcoui...@gmail.com wrote: The problem seems to be located around these parts: var CheckedIDs = []; $(input.item_id).livequery('each',function(add) { if (this.checked){ alert('push'); CheckedIDs.push($(this).attr(value)); } }); On 31 déc, 15:26, jjshell blahblahcoui...@gmail.com wrote: Thanks for your reply :) I only get the alert nothing selected though... Tried to go through the code, couldn't find what is wrong... Regards, -jj. On 31 déc, 14:51, MorningZ morni...@gmail.com wrote: Not sure if it's the *best* way, but it works I'd do something like var CheckedIDs = []; $(input.item_id).each(function() { if
[jQuery] Jquery and math (resize image through a slider?)
I want to scale images via Jquery's UI slider much like this: $('.imageExample').css('height', ui.handle.css('left')); But I don't want to do it in a ratio 1:1 way i would like to say: $('.imageExample').css('height', ui.handle.css('left') / 200 * 100 ); But this does not work? How do I do math operations in Jquery / JavaScript correctly?
[jQuery] Re: How to handle responses from PHP with $.ajax()
On another thread, someone pointed out to me that json_encode was supposed to 'know' if the data values were numeric or string and only quote the latter. That was not my experience, and perhaps not yours, either. Try '1' as the value you compare to instead of 1. On Jan 4, 1:05 pm, rob303 r...@cube33.com wrote: Interestingly, in the Firebug console I'm seeing the correct responses: {result:1} or {result:0} How can I access these inside my $.ajax() call? Many thanks again for all the help! Rob. On Jan 4, 5:57 pm, rob303 r...@cube33.com wrote: Yes, the missing semicolons are an error in the post. I tried to echo the json_encode() call but I still can't get it to work. If I leave the email input blank no email is sent. If I enter a string the email is sent. The 'div.error' is always displayed regardless what's posted. Here's my full code again: -- HTML / Ajax -- ?php require_once(../inc/site_config.php); require_once(SITE . /includes.php); ? html head script src=js/jquery.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php?v=1, data: email=+ email, success: function(res){ if(res.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); /script /head body form id=submit method=post Email: input id=email class=text name=email size=20 type=text / input type=submit value=send mail / /form div class=success style=display:none; Email sent. /div div class=error style=display:none;err/div /body /html -- PHP -- ?php require_once(includes.php); $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); $json_data = array('result' = 1);} else { $json_data = array('result' = 0); } echo json_encode($json_data); ? $message = $_POST['email']; if($message != '') { mail('@cube33.com', 'Ajax test', $message); $json_data = array('result' = 1);} else { $json_data = array('result' = 0); } echo json_encode($json_data); ? -- On Jan 4, 5:44 pm, donb falconwatc...@comcast.net wrote: You must 'echo' the JSON output. Also you indicate periods ending code lines, instead of semicolons but perhaps that's just an error in your post, not the actual code? On Jan 4, 10:38 am, rob303 r...@cube33.com wrote: Hi, Many thanks for the help. I had a go at implementing what you suggested but I'm clearly still missing something. Here is my $.ajax() call: -- $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php, data: email=+ email, success: function(del){ if(del.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); -- And here is my json array in PHP: -- $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); $json_data = array('result' = 1).} else { $json_data = array('result' = 0, 'error' = 'This is an error'). } json_encode($json_data); -- I'm obviously not accessing del.result correctly because $ ('div.error').show(); is always executed regardless of the value of result. Where am I going wrong? Thanks in advance, Rob. On Jan 4, 2:41 pm, donb falconwatc...@comcast.net wrote: Return a JSON object. Construct a PHP array such as $json_data = array('result' = 0, 'error' = 'This is an error'). End your PHP script with json_encode ($json_data). Then you can reference del.result and del.error (I'm referring to your definition of the' success' function from your sample code) On Jan 4, 7:16 am, rob303 r...@cube33.com wrote: Hi, I'm new to ajax and jquery but I'm not new to PHP. The following example seems to work okay to a point but I can't figure out how to handle data validation
[jQuery] jQuery ClueTip issue...
I have the jQuery cluetip project compiled and running fine in its own project, but am having a problem including it in my own project. I have tested this out both in IE7 and Firefox 3. It works fine in FF, but in IE7, the cluetip doesn't show up. However, if you resize the page, all of a sudden the cluetip starts working. I have tried debugging through the cluetip and it runs through all its initialization just fine on the document.ready function. Here is a link to the specific page I am working with: http://67.199.40.37/Pages_Calendar/January.aspx (click on the Monte Carlo night or Polar Bear party links) The site is still under construction, so please forgive the looks. Again, if you view the site in Firefox, the cluetips work fine. But in IE7, you have to click on the Restore Down/Maximize button (next to the close button at the top right of the browser), to get it to work. I only found this by accident when I moved the IE7 browser session from my right monitor to my left one. Up to that point, I simply thought it was just not working. I have only used the simplest case to start, with an anchor tag having a class of title like the first example. Thanks to anyone who can help.
[jQuery] Re: jQuery Pagination and MySQL $limit, $offset
hi ^^ you can use the easyPagi this. It is plugin easy to use. Please visit here view demo and download http://goldengate.com.vn/pagination/ 2009/1/4 ripcurlksm kevin.mccorm...@cox.net I am trying to use the jQuery pagination plugin with my PHP/MySQL website -- It appears I have to either use Ajax or use PHP to write the jQuery pagintion header so I can control the $offset and $limit, in order to control the pagination -- What is the best way to combine javascript, PHP and MySQL so that they can communicate with eachother? Here is my PHP page and SQL script type=text/javascript src=include/jquery-latest.js/script script type=text/javascript src=include/tablesorter/addons/pagination/jquery.pagination.js/script link rel=stylesheet href=include/tablesorter/addons/pagination/pagination.css type=text/css media=print, projection, screen / script type=text/javascript function pageselectCallback(page_id, jq){ $('#Searchresult').text(Showing search results +((page_id*10)+1)+-+((page_id*10)+10)); } $(document).ready(function(){ // Create pagination element $(#Pagination).pagination(300, { num_edge_entries: 2, num_display_entries: 8, callback: pageselectCallback }); }); /script div id=Pagination class=pagination/div br style=clear:both; / div id=Searchresult Showing search results 1-10 ... /div ?php $limit = 10; $offset = 0; dbConnect(); $sql = SELECT * FROM emt_company LIMIT $offset, $limit; $result = mysql_query($sql) or die(mysql_error()); $num = mysql_num_rows($result); while($row = mysql_fetch_assoc($result)){ $name = $row['name']; echo $namebr; } ? (sorry for posting code--- is there a [code] or [html] setting to wrap code?) -- View this message in context: http://www.nabble.com/jQuery-Pagination-and-MySQL-%24limit%2C-%24offset-tp21270953s27240p21270953.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- - Administrator : Ken Phan Websmater : www.kenphan.com http://kenphan19.blogspot.com --
[jQuery] jQuery way
Hi all! Is there better way? var elem = $('#container')[0]; var arr = [header,content,footer]; jQuery.each(elem.childNodes,function(k,v) { if (jQuery.inArray(v.id, arr) 0) { $(v).empty(); } }) thanks Dirceu Barquette
[jQuery] Re: Check both fields together with ajax
Ok, so at least is there a possibility to run checking validation for one specified field? Something like $('my_field').validate()? But without cache for ajax. On Jan 3, 1:53 pm, neo tkolodziej...@gmail.com wrote: Hi, I'm playing with validation and I encountered a problem. I have a text input and a select button. I want to check whether they aren't empty and check via ajax if it's valid (user's typing alias and domain) I was trying to disable validation for text input and just set it an event which fires validation connected with the second field, but it seems that there's problem with cache linked with ajax. My code: domain:{ required: true, alias: true, remote: { url: 'check.php', type: 'get', data: { alias: function() { return $('#alias').val(); } } } } jQuery.validator.addMethod(alias, function(value, element) { return $('#alias').val().length 0 }, Please enter alias);
[jQuery] Re: jQuery way
Maybe: $(#container).children().not(#header, #content, #footer).empty(); --John On Sun, Jan 4, 2009 at 2:05 PM, Dirceu Barquette dirceu.barque...@gmail.com wrote: Hi all! Is there better way? var elem = $('#container')[0]; var arr = [header,content,footer]; jQuery.each(elem.childNodes,function(k,v) { if (jQuery.inArray(v.id, arr) 0) { $(v).empty(); } }) thanks Dirceu Barquette
[jQuery] Re: Ten(14) Reasons why Couchdb is better than Mysql (Off topic - might be interesting)
On almost every list that I'm subscribed to this guy posted the same message. Unless you have a use case, and are comparing the two with regards to the use case (why one would be a better choice than the other), a comparison such as yours only illustrates how much you have to learn about CouchDB. On Jan 3, 4:04 pm, mobiledream...@gmail.com wrote: http://pylab.blogspot.com/2009/01/ten-reasons-why-couchdb-is-better-t... Guys I wrote up a small list of reasons why i think couchdb is way bettter than mysql. Do let me know what you think -- Gpirate the top torrent search enginehttp://gpirate.com
[jQuery] Re: How to force a child page to open in iframe using jquery
The site used a frame braker for a reason, which is, I do not want my site be in someone elses frame. Please respect that or contact that site admin. On Jan 4, 2:43 am, AbhishEk mithuabh...@gmail.com wrote: plz help On Fri, Jan 2, 2009 at 5:44 PM, AbhishEk mithuabh...@gmail.com wrote: actually , the written javascript directly checks the url of browser nd if it finds a dff , it fires a location.replace command . Plz suggest how can i stop this default behaviour. On Fri, Jan 2, 2009 at 6:51 AM, Ricardo Tomasi ricardob...@gmail.comwrote: If the iframe has access to the parent frame it's on the same domain, then you have access to it right? I think there's nothing you can do to stop that. On Jan 1, 8:24 am, AbhishEk mithuabh...@gmail.com wrote: Hi, I have a WebPage on which i have an iframe inside which i open child pages . In one of the child pages following script is written script type=text/javascript if (self != top) { if (window.location.href.replace) top.location.replace(self.location.href); else top.location.href=self.document.href; } /script Which replaces my original url to its url and my page is gone .. is there any way using jquery that i can stop this page from bursting my iframe. Plz Help. Thanks in advance ~abhi
[jQuery] Re: questions on event delegation
On Sun, Jan 4, 2009 at 10:27 AM, holandmij...@gmail.com wrote: Being an self taught old school C coder I thought it would be easier to migrate to PHP but I cant really complain other than my termanology yes thats exactly correct the anchor inside the div Looks like we have a similar background wrt to programming. just curious would this after reloading the content div without binding will this find any anchor elements loaded inside the div and report them to the alert box note I removed the 'li' from parent() $('#content a').click(function(event) { alert($(this).parent().attr('id')); event.preventDefault(); }); No, because when the above routine runs, jQuery binds the handler to all the links that match. Any links which *are not yet there* will, of course, not be bound. This is where LiveQuery comes in, because it's told to watch certain elements and add whatever bindings to any new child elements (that match the selector) which might happen to come along. even if that doesn't I'm pretty sure that removing that anchor that was loaded in the new content would allow it to return the id of the parent of a clicked object ... $('#content').click(function(event) { alert($(this).parent().attr('id')); event.preventDefault(); }); That's almost it. The trick is to use the event object to find the target (the link, in this case): $('#content').click(function(event) { var target = event.target; alert($(target).parent().attr('id')); /* you can use this instead of event.preventDefault() */ return false; }); Because the div isn't going anywhere, the handler will always work. And the event object doesn't care if the anchor only just appeared in the document. It gets clicked, and it becomes that event's target. Now, you actually want the ID of the link, not the parent, so ... alert($(target).attr('id')); Here's a quick example, no ajax necessary. $(function() { $('#content a').click(function(event) { alert($(this).parent().attr('id')); return false; }); $('#add_1').click(function(event) { $('#content').append('a href=#click again/a'); return false; }); $('#delegated_content').click(function(event) { var target = event.target; alert($(target).attr('id')); return false; }); $('#add_2').click(function(event) { $('#delegated_content').append('a href=# id=link_'+ get_id() +'click again/a'); return false; }); /* this is just a closure to produce unique IDs. * Taken from the ajax-upload plugin, by Andris Valums. */ var get_id = function(){ var id = 1; return function(){ return ++id; } }(); }); div id=content a href=#content click/a /div a href=# id=add_1add to content/a div id=delegated_content a href=# id=link_1delegated content click/a /div a href=# id=add_2add with delegation/a
[jQuery] Re: How to handle responses from PHP with $.ajax()
Hi again, I tried that but got the same results. if(res.result == '1') { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } if(res.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } res.result is always false even though firebug says the response is {result:1}. Rob. On Jan 4, 7:01 pm, donb falconwatc...@comcast.net wrote: On another thread, someone pointed out to me that json_encode was supposed to 'know' if the data values were numeric or string and only quote the latter. That was not my experience, and perhaps not yours, either. Try '1' as the value you compare to instead of 1. On Jan 4, 1:05 pm, rob303 r...@cube33.com wrote: Interestingly, in the Firebug console I'm seeing the correct responses: {result:1} or {result:0} How can I access these inside my $.ajax() call? Many thanks again for all the help! Rob. On Jan 4, 5:57 pm, rob303 r...@cube33.com wrote: Yes, the missing semicolons are an error in the post. I tried to echo the json_encode() call but I still can't get it to work. If I leave the email input blank no email is sent. If I enter a string the email is sent. The 'div.error' is always displayed regardless what's posted. Here's my full code again: -- HTML / Ajax -- ?php require_once(../inc/site_config.php); require_once(SITE . /includes.php); ? html head script src=js/jquery.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php?v=1, data: email=+ email, success: function(res){ if(res.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); /script /head body form id=submit method=post Email: input id=email class=text name=email size=20 type=text / input type=submit value=send mail / /form div class=success style=display:none; Email sent. /div div class=error style=display:none;err/div /body /html -- PHP -- ?php require_once(includes.php); $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); $json_data = array('result' = 1);} else { $json_data = array('result' = 0); } echo json_encode($json_data); ? $message = $_POST['email']; if($message != '') { mail('@cube33.com', 'Ajax test', $message); $json_data = array('result' = 1);} else { $json_data = array('result' = 0); } echo json_encode($json_data); ? -- On Jan 4, 5:44 pm, donb falconwatc...@comcast.net wrote: You must 'echo' the JSON output. Also you indicate periods ending code lines, instead of semicolons but perhaps that's just an error in your post, not the actual code? On Jan 4, 10:38 am, rob303 r...@cube33.com wrote: Hi, Many thanks for the help. I had a go at implementing what you suggested but I'm clearly still missing something. Here is my $.ajax() call: -- $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php, data: email=+ email, success: function(del){ if(del.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); -- And here is my json array in PHP: -- $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); $json_data = array('result' = 1).} else { $json_data = array('result' = 0, 'error' = 'This is an error'). } json_encode($json_data); -- I'm obviously not accessing del.result correctly because $ ('div.error').show(); is always executed regardless of the value of result. Where am I going wrong? Thanks in advance, Rob. On Jan 4, 2:41 pm, donb falconwatc...@comcast.net wrote:
[jQuery] Re: jQuery way
This might be shorter. $(#container :not(#header, #content, #footer)).empty(); - Kean Tested with Sizzle but not jQuery 1.2.6 On Jan 4, 11:08 am, John Resig jere...@gmail.com wrote: Maybe: $(#container).children().not(#header, #content, #footer).empty(); --John On Sun, Jan 4, 2009 at 2:05 PM, Dirceu Barquette dirceu.barque...@gmail.com wrote: Hi all! Is there better way? var elem = $('#container')[0]; var arr = [header,content,footer]; jQuery.each(elem.childNodes,function(k,v) { if (jQuery.inArray(v.id, arr) 0) { $(v).empty(); } }) thanks Dirceu Barquette
[jQuery] Re: How is it possible to have click on each 'a href' menu item and ALSO have another 'a href' trigger as well?
On Sun, Jan 4, 2009 at 4:56 AM, yvonney yvonn...@gmail.com wrote: Hi... ALL the following occurs on ONE page of markup with ONE css file. [OBJECTIVE: when I click on my menu items I need another 'a href' to ALSO trigger it's link event. I COULD put the second set of link somewhere visible out of the way, though I just need them to be invoked, one for one for each of the menu items. I think you'd be far better off re-thinking how your application works. Why go to the trouble of triggering an anchor's click handler when you can simply invoke some function which *also* is invoked by the link's click?
[jQuery] Re: How to enable intellisence for Jquery in zend studio for eclipse
Zend Studio supports Dojo very well since it's the official javascript framework, I'm not sure whether it's possible to enable jQuery calltips (Komodo synonym of Intellisence) in Zend Studio let stand how to enable it. However, Komodo IDE has this kind of feature for jQuery and other frameworks. There's also an opensource alternative called Komodo Edit. On Sun, Jan 4, 2009 at 1:56 PM, Amin amin...@gmail.com wrote: Im new to javascript and also with JQuery and i need to see functions and objects in Intellisence (auto completion) feature of zend studio. is there any way to make Zend studio to show functions and object of JQuery? i tried to add library (in user library option) in project properties and it just show them in PHP explorer but nothing appear when i try Ctrl+Space in my code. i saw ZS support Dojo nicely and i though maybe it can support JQuery in same way. thanks for support. regards. -- Isaak Malik Web Developer
[jQuery] Re: How to force a child page to open in iframe using jquery
plz help On Fri, Jan 2, 2009 at 5:44 PM, AbhishEk mithuabh...@gmail.com wrote: actually , the written javascript directly checks the url of browser nd if it finds a dff , it fires a location.replace command . Plz suggest how can i stop this default behaviour. On Fri, Jan 2, 2009 at 6:51 AM, Ricardo Tomasi ricardob...@gmail.comwrote: If the iframe has access to the parent frame it's on the same domain, then you have access to it right? I think there's nothing you can do to stop that. On Jan 1, 8:24 am, AbhishEk mithuabh...@gmail.com wrote: Hi, I have a WebPage on which i have an iframe inside which i open child pages . In one of the child pages following script is written script type=text/javascript if (self != top) { if (window.location.href.replace) top.location.replace(self.location.href); else top.location.href=self.document.href; } /script Which replaces my original url to its url and my page is gone .. is there any way using jquery that i can stop this page from bursting my iframe. Plz Help. Thanks in advance ~abhi
[jQuery] How to handle responses from PHP with $.ajax()
Hi, I'm new to ajax and jquery but I'm not new to PHP. The following example seems to work okay to a point but I can't figure out how to handle data validation errors generated in my PHP. In my example I want to post some data to a script called ajax.php. That script will check the data for validity and then return true or false depending on the outcome of the checks. It will also set an appropriate error message. How can I handle the returned data and display an error message if needed in ajax? -- HTML / Ajax - test.php -- ?php require_once(includes.php); ? html head script src=js/jquery.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php, data: email=+ email, success: function(del){ $('form#submit').hide(); $('div.success').fadeIn('medium'); // what if the data failed validation in PHP? // we need to show 'div.error. } }); return false; }); }); /script /head body form id=submit method=post Email: input id=email class=text name=email size=20 type=text / input type=submit value=send mail / /form div class=success style=display:none; Email sent. /div div class=error ?php echo $userError; ? /div /body /html -- PHP - ajax.php -- ?php require_once(includes.php); $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); return 1; } else { $userError = Please enter your email address; return 0; } ? I've been searching the web for an answer but can't find one anywhere! Any help would be greatly appreciated.
[jQuery] Re: Jquery and math (resize image through a slider?)
oh i should have been using ui.value instead: $('.borge').css('height', ui.value * 10); i guess - this seems to work. On Jan 4, 7:51 pm, Janmansilver jan.poul...@gmail.com wrote: I want to scale images via Jquery's UI slider much like this: $('.imageExample').css('height', ui.handle.css('left')); But I don't want to do it in a ratio 1:1 way i would like to say: $('.imageExample').css('height', ui.handle.css('left') / 200 * 100 ); But this does not work? How do I do math operations in Jquery / JavaScript correctly?
[jQuery] Re: How to handle responses from PHP with $.ajax()
Return a JSON object. Construct a PHP array such as $json_data = array('result' = 0, 'error' = 'This is an error'). End your PHP script with json_encode ($json_data). Then you can reference del.result and del.error (I'm referring to your definition of the' success' function from your sample code) On Jan 4, 7:16 am, rob303 r...@cube33.com wrote: Hi, I'm new to ajax and jquery but I'm not new to PHP. The following example seems to work okay to a point but I can't figure out how to handle data validation errors generated in my PHP. In my example I want to post some data to a script called ajax.php. That script will check the data for validity and then return true or false depending on the outcome of the checks. It will also set an appropriate error message. How can I handle the returned data and display an error message if needed in ajax? -- HTML / Ajax - test.php -- ?php require_once(includes.php); ? html head script src=js/jquery.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php, data: email=+ email, success: function(del){ $('form#submit').hide(); $('div.success').fadeIn('medium'); // what if the data failed validation in PHP? // we need to show 'div.error. } }); return false; }); }); /script /head body form id=submit method=post Email: input id=email class=text name=email size=20 type=text / input type=submit value=send mail / /form div class=success style=display:none; Email sent. /div div class=error ?php echo $userError; ? /div /body /html -- PHP - ajax.php -- ?php require_once(includes.php); $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); return 1;} else { $userError = Please enter your email address; return 0; } ? I've been searching the web for an answer but can't find one anywhere! Any help would be greatly appreciated.
[jQuery] Re: jQuery way
Thanks a lot! But it doesn't works... :-( I get a really dirty code to add modules. I wish inject a pretty good jQuery code, but is impossible!!! thanks your attention! Dirceu Barquette 2009/1/4 John Resig jere...@gmail.com Maybe: $(#container).children().not(#header, #content, #footer).empty(); --John On Sun, Jan 4, 2009 at 2:05 PM, Dirceu Barquette dirceu.barque...@gmail.com wrote: Hi all! Is there better way? var elem = $('#container')[0]; var arr = [header,content,footer]; jQuery.each(elem.childNodes,function(k,v) { if (jQuery.inArray(v.id, arr) 0) { $(v).empty(); } }) thanks Dirceu Barquette
[jQuery] Re: jQuery way
Not works too... Thank you. Dirceu Barquette 2009/1/4 Kean shenan...@gmail.com This might be shorter. $(#container :not(#header, #content, #footer)).empty(); - Kean Tested with Sizzle but not jQuery 1.2.6 On Jan 4, 11:08 am, John Resig jere...@gmail.com wrote: Maybe: $(#container).children().not(#header, #content, #footer).empty(); --John On Sun, Jan 4, 2009 at 2:05 PM, Dirceu Barquette dirceu.barque...@gmail.com wrote: Hi all! Is there better way? var elem = $('#container')[0]; var arr = [header,content,footer]; jQuery.each(elem.childNodes,function(k,v) { if (jQuery.inArray(v.id, arr) 0) { $(v).empty(); } }) thanks Dirceu Barquette
[jQuery] drag and drop fileupload with jquery
hi there, is a drag and drop fileupload with jquery possible? are there existing plugins? thanks in advance jay
[jQuery] Re: Invalid Json Primitive
hi michael, I tried as you mentioned below but this time i am getting uncaught exception: Access to restricted URI denied (NS_ERROR_DOM_BAD_URI) is the json with jquery right way to do that or i should try alternative ways ? could you share any sample with us if you have any ? thanks tep Michael Geary-3 wrote: Since you're not making a cross-domain request, why are you using JSONP instead of regular JSON? I would think you would just use JSON. JSONP uses a script element instead of XMLHttpRequest, so most of the Ajax parameters like the beforeSend and error functions don't apply. I don't know what the Invalid Json Primitive message means or where it's coming from, though. That's not part of jQuery. -Mike From: tep Any comment, waiting your help tep wrote: Hello all, I am trying to create a widget within .NET that's why using JSONP. But when i run the code below, i get the error 'Invalid Json Primitive' on client side before calling web service , how can i handle that ? function test2() { var params = '{wdgtype:1}'; $.ajax({ type: POST, url: service.aspx/GetWidget, data: params, // Set Method Params beforeSend: function(xhr) { xhr.setRequestHeader(Content-length, params.length); xhr.setRequestHeader(Content-type, application/json; charset=utf-8);}, contentType: application/json; charset=utf-8, dataType: jsonp, jsonp:onJsonPLoad, success: function(msg) { $(#showyrmwidget).html(msg.d); }, error: function(xhr,msg,e){ alert(xhr.responseText);//Error Callback } }); } function onJsonPLoad(data) { alert(data); } [WebMethod()] public static string GetWidget(string wdgtype) { return test; } Thanks -- View this message in context: http://www.nabble.com/Invalid-Json-Primitive-tp21229536s27240p 21248615.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Invalid-Json-Primitive-tp21229536s27240p21280695.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Time since last event?
The event object received by all event handlers has a timeStamp property which contains the (again) timestamp in milliseconds. You can keep that value to know how much time passed since last event. You can also create your own timestamp by calling new Date().getTime (). -- Ariel Flesler http://flesler.blogspot.com On Jan 4, 10:45 am, Mads mads...@gmail.com wrote: I'm working on spicing up a search bar so it loads the results through an ajax call. I throws the request whenever a keyup event has been fired in the input field, my code looks like this: inputValue = jQuery(input#s).val(); url = http://www.iconpark.net/?s=; + inputValue + #content *; jQuery(#content).slideUp(800, function() { jQuery(#content).load(url,{},function() { jQuery(#content).slideDown(500, function() { jQuery('p:contains('+inputValue+')').each(function(){ jQuery(this).html(jQuery(this).html().replace(new RegExp (inputValue,'g'), 'span class=highlighted'+inputValue+'/span')); }); }); jQuery.getScript(http://www.iconpark.net/wp-content/themes/ PixelResort/javascript/myScripts.js); }); }); I works fine, it wraps the search results with span class=highlighted/span, however, at the moment it creaets as many span tags as key-up events so I'm wondering if there is a to calculate the time that has elapsed since last key-up event so I could call the jQuery code that hightlights the search results only when a second has passed since last kep-up event?
[jQuery] Re: event.preventDefault() not in the intellisense?
I haven't used Visual Studio in a while, and never for js... But... how would it know it is an event object ? It's just an argument of a function that could be anything... -- Ariel Flesler http://flesler.blogspot.com On Jan 4, 1:54 am, yww yww...@gmail.com wrote: Hi I am new to this group and also new to Jquery. So I am just trying the sample in tutorials. Basically it works very nicely. But there is a small flaw while I was playing with JQuery, that I can't get the intellisnse help from visual studio. and I have captured the screen shot as following: http://picasaweb.google.com/lh/photo/i6GxK88a7vxrQR9qS8BARQ?feat=dire... so you see I have add reference to jquery-1.2.6-vsdoc.js, but there is no preventDefault() method for event object. What should I do to enable that? by the way, although the method was not listed, it can be used correctly and really prevented the click event.
[jQuery] Re: How is it possible to have click on each 'a href' menu item and ALSO have another 'a href' trigger as well?
I was going to guess what your HTML looks like and show you how to trigger an event on another element, but I figured it would help much. I see you have posted already half a dozen messages on the same subject here, why not put a test page or a mock-up of your app online, so we can see how it's structured and how it works, and then maybe propose something useful to you? cheers, - ricardo On Jan 4, 7:56 am, yvonney yvonn...@gmail.com wrote: Hi... ALL the following occurs on ONE page of markup with ONE css file. [OBJECTIVE: when I click on my menu items I need another 'a href' to ALSO trigger it's link event. I COULD put the second set of link somewhere visible out of the way, though I just need them to be invoked, one for one for each of the menu items. So: have menu with 12 items and when each item is clicked need one of each of the second set of basic 'a href' link to happens also. One to one relationship. 12 seperate menu items for 12 seperate set of anchors items. I have a basic menu with a whole bunch of lis like this and it works fine: lia href=#firstname of menu item/a/li The '#first' triggers a bunch of moves as does each menu item. So each menu has different a different # name. I don't know how irrelevant this might be. Secondly I have a bunch of anchors I think they're called.: a href=vid4.flvWatch my movie!/a I want these to happen when the first set of lis are clicked. I can add unique class, name id to them though I don't know what might be best. ??? thank you!
[jQuery] Re: What does el mean in jQuery code?
Function arguments have no value by themselves. el is just a short for element, to make scripts understandable, it makes it explicit that an element is expected. function something(string){ //doSomething } something(this is a string but could be anything else) On Jan 3, 11:44 pm, jNewb benstockdes...@gmail.com wrote: My question to you seasoned jQuery veterans is this: Throughout the many plugins I have devoured while attempting to learn all of the secrets/gloriness of jQuery, I constantly run into something like or close to codefunction(el){ //Code Here }/code. I'm guessing el is short for element and it's a variable of some sort, but knowing my luck with programming anything, I'm completely wrong. I've searched Google all night, but to no avail. Any help would be great, thanks! P.S. On AIM, my SN is benstockdesign. Feel free to IM me anytime (No cybering ladies... I'm strictly keeping my mind on traversing, chaining, and manipulating! haha). -Ben Stock, jQuery/Scripting Newb
[jQuery] Re: jquery.cycle.lite.js
Thanks Mike! After changing from cycle lite to full version and played with my code a little it works. I'm far from a finished site (http://optimistclubofstandrews.org/ default.html) but, I'll get there. Really appreciate the jump and you even had the cables! don On Jan 3, 8:16 pm, Mike Alsup mal...@gmail.com wrote: I'm very new to HTML and newer to JavaScript. Just getting started with Expression Web 2. I downloaded jquery.cycle.lite.js thinking I can use it for simple swapping of photos in a space on my opening (home) page. I've put following in my file. script src=jquery.cycle.lite.js type=text/javascript !-- // -- /script But, can't figure out what to put between the comment tags. And, what else will be needed. I'm sure somehow I must assign the graphic files to be used and probably more. A jump start will be most appreciated! don Hi Don, View the source on this page: http://jquery.malsup.com/cycle/simple.html That is the simplest demo that I have. In your case you can change the script reference from jquery.cycle.js to jquery.cycle.lite.js. Remember to be sure that the script references to both jquery and cycle point to the correct folders on your server. In my case the scripts are stored in different folders. Cheers! Mike- Hide quoted text - - Show quoted text -
[jQuery] Re: Media Plugin (malsup site) REPLACE code uses OLD metadata.js - ALSO: nothing works in IE6/IE7
I figure that something about my markup and the stuff I added to the top of the replace code is causing some weirdness. THOUGH WHY does it work in FF and opera WITH the version 1.0 metadata...??? I AM running the latest JQuery 1.2.6 ... againall good fun...truly! So, back to the testing station ANY thoughts welcomed, of course! Can you create a small demo page that shows the problem and post a link here?
[jQuery] Re: How to handle responses from PHP with $.ajax()
After a little more twiddling ... This works: $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php, data: email=+ email, success: function(res){ if(res == {\result\:1}) { $('form#submit').hide(); $('div.error').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); The json object contains what I need but I can only test it as if it were a string. res.result is undefined. Why? Thanks in advance for any help! Rob. rob303 wrote: Hi again, I tried that but got the same results. if(res.result == '1') { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } if(res.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } res.result is always false even though firebug says the response is {result:1}. Rob. On Jan 4, 7:01�pm, donb falconwatc...@comcast.net wrote: On another thread, someone pointed out to me that json_encode was supposed to 'know' if the data values were numeric or string and only quote the latter. �That was not my experience, and perhaps not yours, either. �Try '1' as the value you compare to instead of 1. On Jan 4, 1:05�pm, rob303 r...@cube33.com wrote: Interestingly, in the Firebug console I'm seeing the correct responses: {result:1} or {result:0} How can I access these inside my $.ajax() call? Many thanks again for all the help! Rob. On Jan 4, 5:57�pm, rob303 r...@cube33.com wrote: Yes, the missing semicolons are an error in the post. I tried to echo the json_encode() call but I still can't get it to work. If I leave the email input blank no email is sent. If I enter a string the email is sent. The 'div.error' is always displayed regardless what's posted. Here's my full code again: -- HTML / Ajax -- ?php require_once(../inc/site_config.php); require_once(SITE . /includes.php); ? html � head � � � � script src=js/jquery.js type=text/javascript/script � � script type=text/javascript � � � $(document).ready(function(){ � � � � $(form#submit).submit(function() { � � � � � var email = $('#email').attr('value'); � � � � � $.ajax({ � � � � � � type: POST, � � � � � � url: ajax.php?v=1, � � � � � � data: email=+ email, � � � � � � success: function(res){ � � � � � � � if(res.result == 1) { � � � � � � � � $('form#submit').hide(); � � � � � � � � $('div.success').fadeIn('medium'); � � � � � � � } else { � � � � � � � � $('div.error').show(); � � � � � � � } � � � � � � } � � � � � }); � � � � � return false; � � � � }); � � � }); � � /script � /head � body � � � form id=submit method=post � � � � Email: � � � � input id=email class=text name=email size=20 type=text / � � � � � � input type=submit value=send mail / � � � � � /form � � � div class=success style=display:none; � � � � Email sent. � � � /div � � � div class=error style=display:none;err/div � /body /html -- PHP -- ?php require_once(includes.php); $message = $_POST['email']; if($message != '') { � mail('some-em...@email.com', 'Ajax test', $message); � $json_data = array('result' = 1);} else { � $json_data = array('result' = 0); } echo json_encode($json_data); ? $message = $_POST['email']; if($message != '') { � mail('@cube33.com', 'Ajax test', $message); � $json_data = array('result' = 1);} else { � $json_data = array('result' = 0); } echo json_encode($json_data); ? -- On Jan 4, 5:44�pm, donb falconwatc...@comcast.net wrote: You must 'echo' the JSON output. �Also you indicate periods ending code lines, instead of semicolons but perhaps that's just an error in your post, not the actual code? On Jan 4, 10:38�am, rob303 r...@cube33.com wrote: Hi, Many thanks for the help. �I had a go at implementing what you suggested but I'm clearly still missing something. Here is my $.ajax() call: -- $(document).ready(function(){ � � � � $(form#submit).submit(function() { � � � � � var email = $('#email').attr('value'); � � � � � $.ajax({ � � � � � � type: POST, � � � � � � url: ajax.php, � � � � � � data: email=+ email, � � � � � � success: function(del){ � � � � � � � if(del.result == 1) {
[jQuery] Re: How to handle responses from PHP with $.ajax()
I found the problem. I was missing the dataType option: $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php, data: email=+ email, dataType: json, success: function(res){ if(res.result == 1) { $('form#submit').hide(); $('div.error').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); It works just fine now. Cheers, Rob. On Jan 4, 10:12 pm, rob303 r...@cube33.com wrote: After a little more twiddling ... This works: $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php, data: email=+ email, success: function(res){ if(res == {\result\:1}) { $('form#submit').hide(); $('div.error').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); The json object contains what I need but I can only test it as if it were a string. res.result is undefined. Why? Thanks in advance for any help! Rob. rob303 wrote: Hi again, I tried that but got the same results. if(res.result == '1') { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } if(res.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } res.result is always false even though firebug says the response is {result:1}. Rob. On Jan 4, 7:01 pm, donb falconwatc...@comcast.net wrote: On another thread, someone pointed out to me that json_encode was supposed to 'know' if the data values were numeric or string and only quote the latter. That was not my experience, and perhaps not yours, either. Try '1' as the value you compare to instead of 1. On Jan 4, 1:05 pm, rob303 r...@cube33.com wrote: Interestingly, in the Firebug console I'm seeing the correct responses: {result:1} or {result:0} How can I access these inside my $.ajax() call? Many thanks again for all the help! Rob. On Jan 4, 5:57 pm, rob303 r...@cube33.com wrote: Yes, the missing semicolons are an error in the post. I tried to echo the json_encode() call but I still can't get it to work. If I leave the email input blank no email is sent. If I enter a string the email is sent. The 'div.error' is always displayed regardless what's posted. Here's my full code again: -- HTML / Ajax -- ?php require_once(../inc/site_config.php); require_once(SITE . /includes.php); ? html head script src=js/jquery.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $(form#submit).submit(function() { var email = $('#email').attr('value'); $.ajax({ type: POST, url: ajax.php?v=1, data: email=+ email, success: function(res){ if(res.result == 1) { $('form#submit').hide(); $('div.success').fadeIn('medium'); } else { $('div.error').show(); } } }); return false; }); }); /script /head body form id=submit method=post Email: input id=email class=text name=email size=20 type=text / input type=submit value=send mail / /form div class=success style=display:none; Email sent. /div div class=error style=display:none;err/div /body /html -- PHP -- ?php require_once(includes.php); $message = $_POST['email']; if($message != '') { mail('some-em...@email.com', 'Ajax test', $message); $json_data = array('result' = 1);} else { $json_data = array('result' = 0); } echo json_encode($json_data); ? $message = $_POST['email']; if($message != '') { mail('@cube33.com', 'Ajax test', $message); $json_data = array('result' = 1);} else { $json_data = array('result' = 0); } echo json_encode($json_data); ? -- On Jan 4, 5:44 pm, donb falconwatc...@comcast.net wrote: You must 'echo' the JSON output. Also you indicate periods ending code lines, instead of semicolons but perhaps that's just an error in your post, not the actual code? On Jan 4, 10:38 am, rob303 r...@cube33.com wrote: Hi,
[jQuery] animations staggering when $().load called _ advise please
Hello friends, I have a dropdown menu that animates horziontally each time you click on one its links. Some of them reveal a submenu, others load some html via ajax ($(container).load();) and others do both. I notice that animations tend to stagger when ajax calls are under progress . What would be a good approach to remove these lags? Of course, once the data is loaded and in the cache, no more staggering. There is a lot of html bits so preloading all of them is not really my favourite option, so here i stand, asking for your advises. Thank you and have a great week ! Alexandre
[jQuery] Re: How to check all required fields after each field is filled...
Thanks, Joe! Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Joe Sent: Sunday, January 04, 2009 1:30 PM To: jQuery (English) Subject: [jQuery] Re: How to check all required fields after each field is filled... This works, but is not terribly usable as it throws an alert every after every failed scan, but you can easily modify the method to make it more usable, or even simply remove the alert and the button will remain disabled until all required fields are filled in. It could be optimized a bit, but for clarity it's a bit verbose. Copy and paste this into a new .html file and load in your browser. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en-us lang=en dir=ltr head script type=text/javascript src=http://ajax.googleapis.com/ ajax/libs/jquery/1.2.6/jquery.js /script script type=text/javascript $(function(){ // Cached the wrapped set. $req = $('input.required'); // A flag for scan results. $.reqFlag = { pass: null, failMethod: function(){ alert('Please Fill In All Required Fields'); }, passMethod: function(){ $('#submitButton').attr('disabled',false); } } // Scan method. $.scan = function(){ $req.each(function(){ !$(this).val() ? $.reqFlag.pass = false : $.reqFlag.pass = true; }) !$.reqFlag.pass ? $.reqFlag.failMethod() : $.reqFlag.passMethod(); } $req.each(function(){ $(this).blur(function(){ $.scan() }); }); }); /script /head body form action= input class='required' name=one type=text / br / input class='required' name=two type=text / br / input class='required' name=three type=text / br / input class='required' name=four type=text / br / input type='submit' value='go' id=submitButton disabled=true / /form /body /html On Jan 3, 9:58 pm, Rick Faircloth r...@whitestonemedia.com wrote: Thanks for the reply, Joe... To answer your question: I want to check the required fields for any that are still invalid after a user blurs out of any required field. Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Joe Sent: Saturday, January 03, 2009 10:15 PM To: jQuery (English) Subject: [jQuery] Re: How to check all required fields after each field is filled... However, I want to be able to scan all required fields after each field is filled in and see if any required fields remain to be satisfactorily completed. When do you want to scan? After the user blurs out of the last input? Or blurs out of any required input (because technically the user could skip around on the form)? You obviously can't do it on submit because the button is disabled. I have an idea of how to do it, but you need to dictate the event handler that is going to do trigger the scanning. Joe http://www.subprint.com On Jan 3, 6:17 pm, Rick Faircloth r...@whitestonemedia.com wrote: Anyone? I'm trying to validate a form. All the validation I've implemented up to this point is working fine. However, I want to be able to scan all required fields after each field is filled in and see if any required fields remain to be satisfactorily completed. If there are any, I want to keep the submit button on my form disabled. I'm trying to use this code: $(':input.required').each(function() { var val = (this.value.length); if (val == 0) { $('#submit').attr('disabled', 'disabled'); }; }); However, each time I fill in a required field, the submit button is enabled. (I realize for now that the code above is only checking length and I can add other checks later, but wanted to get this one working first. Any clues? Thanks, Rick
[jQuery] Re: Media Plugin (malsup site) REPLACE code uses OLD metadata.js - ALSO: nothing works in IE6/IE7
nice Mike! I'll try to get that together. all currentrly localhost and virtual machines. After I do some logic testing to narrow things down I'll write back and hopefully post or whatever. Im gonna remove variables and start with a pure media plugin test page and remove all my flashvar markup that's ib BOTH the top of the script (top of your remove code example) AND also the flashvars that are in my markup, inline I think it's called. I am using the jquery 1.2.6 so it's weird that only version 1.0 of the metadata plugin works... though not at all with IEs. I'll start from scratch and likely have something good to say.. BIG thanks for writing Would have liked to have been more succinct instead of all the posts here everyone, so thanks for understanding.
[jQuery] Re: UI Colorpicker plugin doesn't work with IE
Not soon enough for me I'm afraid. Please be free to use the CSS and HTML on my example to update the plugin or the documentation if you find it useful. --Samuel On Dec 29 2008, 5:02 pm, Richard D. Worth rdwo...@gmail.com wrote: These are known issues and are some of the reasons colorpicker was removed after 1.6rc2. It will not be in the 1.6 final release, but will be refactored, hopefully in time for 1.7. - Richard On Sun, Dec 28, 2008 at 4:59 PM, Samuel Santos sama...@gmail.com wrote: I've been trying to get the UI Colorpicker plugin working, but it has been tricky because the documentation and CSS styles are either missing or pretty buggy. I've got a working example a href=http://samaxes.appspot.com/zip/ colorpicker.zip http://samaxes.appspot.com/zip/colorpicker.ziphere/a. My example works correctly with almost all the browsers I've tested it with (Firefox, Chrome, and Safari), but unfortunately it doesn't work with IE (tested with IE7). I've fixed the CSS bugs, but I'm yet to find if there is any JavaScript bug. Have anyone successfully make it working with IE? If yes, please let me know how.
[jQuery] Re: UI Colorpicker plugin doesn't work with IE
Not soon enough for me I'm afraid. Please be free to use the CSS and HTML on my example to update the plugin or the documentation if you find it useful. --Samuel On Dec 29 2008, 5:02 pm, Richard D. Worth rdwo...@gmail.com wrote: These are known issues and are some of the reasons colorpicker was removed after 1.6rc2. It will not be in the 1.6 final release, but will be refactored, hopefully in time for 1.7. - Richard On Sun, Dec 28, 2008 at 4:59 PM, Samuel Santos sama...@gmail.com wrote: I've been trying to get the UI Colorpicker plugin working, but it has been tricky because the documentation and CSS styles are either missing or pretty buggy. I've got a working example a href=http://samaxes.appspot.com/zip/ colorpicker.zip http://samaxes.appspot.com/zip/colorpicker.ziphere/a. My example works correctly with almost all the browsers I've tested it with (Firefox, Chrome, and Safari), but unfortunately it doesn't work with IE (tested with IE7). I've fixed the CSS bugs, but I'm yet to find if there is any JavaScript bug. Have anyone successfully make it working with IE? If yes, please let me know how.
[jQuery] Re: How is it possible to have click on each 'a href' menu item and ALSO have another 'a href' trigger as well?
wow fantactic for the replies... This is SO important for me today. I need to keep my menu as it is and I figure it'll be more modular that way. BASED on my lack of skill that is. Then later I can go for something better. I have spent way want way every day on this. And yes, I'm so sorry about what appear to be multiple simplar posts and help requests.. Thing is it's basically one menu that works, and wanting to have videos show up in a sperate div when I click on each existing menu item. So what happened was over the course of trying all the media plugins and other stuff I 'thought' I was getting there, only to find I had to go back and switch plugins again... etc So yea,,, REALLY sorry about all that. I am working hard to become skilled enough and hope to be a better member of this group ASAP. Thank you for your patience. Will write after I think about this. basically I don't care how messy it is... just wanna call the other href WHEN I click on the existing links.. right now the videos show up when I want them to though I have to click on each of the a href's for them... I can add pretty much whatver to the existing menu items... each menu item (that's already there and working) needs to trigger a seperate video... SO: would I add a unique class or unique name to each working menu item (and maybe one to each video a href also?) and then somehow use a jquery little script to call each together with one click each on the working menu. sheesh... any deas? I know it sounds ultimately Un-Elegant... I will become more skilled soon0ish though right now need this to work... can you help with a bit of code? and whether I need to add something unique to the existing menu, as above? AND the video a hrefs I want to bind/call (or?) together? and whatever happens, thank you for your time. sincerely.
[jQuery] Re: IE + jQuery + fixed elements != happiness
As it turns out, this is a problem in FF too. I was confusing projects. Sorry.
[jQuery] IE + jQuery + fixed elements != happiness
I created a simple page that contains numerous paragraphs, and a position:fixed div at the top of the page. The div at the top is called jquery-panel. jQuery-Panel conatins two nested divs: panel- content, and panel-handle. By default, panel-content is display:none, and panel-handle is fully visible. The markup follows: div class=jquery-panel div class=panel-content div class=padder pHello World/p /div /div div class=panel-handle/div /div Panel-Handle has a set height in css, and a background image making it appear as a tab of some sort. The jQuery I'm using to add interactivity to this setup is simple. Note, what follows is one of many methods I've attempted to gain the desired effect. I've attempted .hover() on jquery-panel, and also .mouseover, .mouseout - nothing has alleviated the IE problem. $(document).ready(function(){ $(.jquery-panel).hover( function () { $(.panel-content).slideDown(); }, function () { $(.panel-content).slideUp(); } ); }); As you can see from this, the code is rather simple. When the user passes their mouse over jquery-panel (noted for its visible nested div with a class of panel-handle) the nested div.panel-content is suppose to expand, which it does. In FF this works perfectly, but in IE (I'm testing with IE7) the panel immediately collapses once you move your mouse (not leaving jquery-panel, merely moving the mouse side to side). I've also tried the following code: $(document).ready(function(){ $(.jquery-panel).mouseover(function(){ $(.panel-content).slideDown(); }); $(.jquery-panel).mouseout(function(){ $(.panel-content).slideUp(); }); }); As with the previous attempt, I get the immediate closing of panel- content whilst my mouse is still on jquery-panel. I thought it had something to do with position:fixed on the jquery-panel, but when I removed that CSS, the problem persisted. Following is the relevant CSS: div.jquery-panel { position:fixed; top:0; left:0; width:100%; } div.panel-content { background-color:#CC; background-image:url(panelbg.png); background-position:left top; background-repeat:repeat-x; color:#66; font-family:verdana; font-size:12px; display:none; } div.panel-content div.padder { padding:10px; } div.panel-handle { height:15px; position:relative; background-image:url(dropshadow.png); background-position:left top; background-repeat:repeat-x; } Any help would be greatly appreciated. Jonathan Sampson www.sampsonresume.com
[jQuery] How to trigger jQuery action from a php else branch?
I have a login system that has a slideup/slidedown show/hide function for a forgot password link. It is hidden by default and it's triggered with toggle(). Works just fine. I have php validation on that forgot password text field so if someone tries to submit with that field empty they get an error message telling them to enter their email address so we can send them a new password. The issue I'm having is when that error message is triggered, the forgot password text field is hidden, where I want to have it shown as it's a bit jarring to have it suddenly go away and they have to click the trigger to show it again. Anyone have any ideas how I can do this? //FORGOT PASSWORD if (isset($_POST['forgot_password'])) { logic here to send user a new password } else { TRIGGER JQUERY HERE SO FORGOT PASSWORD IS SHOWN //report the errors echo 'div id=errorsspanThe following error(s) occurred:/ span'; echo 'ul'; foreach($errors as $error) { echo li$error/li; } echo '/ul/div'; }
[jQuery] Re: How to trigger jQuery action from a php else branch?
If you're just returning an html snippet, you could include some js. Echo something like this back: script type=text/javascript $('#yourFieldID').show(); // any js you want to fire /script - Jack Magnificent wrote: I have a login system that has a slideup/slidedown show/hide function for a forgot password link. It is hidden by default and it's triggered with toggle(). Works just fine. I have php validation on that forgot password text field so if someone tries to submit with that field empty they get an error message telling them to enter their email address so we can send them a new password. The issue I'm having is when that error message is triggered, the forgot password text field is hidden, where I want to have it shown as it's a bit jarring to have it suddenly go away and they have to click the trigger to show it again. Anyone have any ideas how I can do this? //FORGOT PASSWORD if (isset($_POST['forgot_password'])) { logic here to send user a new password } else { TRIGGER JQUERY HERE SO FORGOT PASSWORD IS SHOWN //report the errors echo 'div id=errorsspanThe following error(s) occurred:/ span'; echo 'ul'; foreach($errors as $error) { echo li$error/li; } echo '/ul/div'; }
[jQuery] Re: How to trigger jQuery action from a php else branch?
Yeah, that's the first thing I tried, but Firebug reports a JS error: $ is not defined On Jan 4, 5:46 pm, Jack Killpatrick j...@ihwy.com wrote: If you're just returning an html snippet, you could include some js. Echo something like this back: script type=text/javascript $('#yourFieldID').show(); // any js you want to fire /script - Jack Magnificent wrote: I have a login system that has a slideup/slidedown show/hide function for a forgot password link. It is hidden by default and it's triggered with toggle(). Works just fine. I have php validation on that forgot password text field so if someone tries to submit with that field empty they get an error message telling them to enter their email address so we can send them a new password. The issue I'm having is when that error message is triggered, the forgot password text field is hidden, where I want to have it shown as it's a bit jarring to have it suddenly go away and they have to click the trigger to show it again. Anyone have any ideas how I can do this? //FORGOT PASSWORD if (isset($_POST['forgot_password'])) { logic here to send user a new password } else { TRIGGER JQUERY HERE SO FORGOT PASSWORD IS SHOWN //report the errors echo 'div id=errorsspanThe following error(s) occurred:/ span'; echo 'ul'; foreach($errors as $error) { echo li$error/li; } echo '/ul/div'; }
[jQuery] Re: How to trigger jQuery action from a php else branch?
This is the particular code I want to execute. #forgot_pass_link is the click trigger on the web page. //forgot password $('#forgot_pass_link').toggle( function(){ $('#login_forgotpass').css('background', '#dbdbdb'); $('#forgot_pass_link').css('background-position', '-10px -772px'); $('#login_submit').css('background', '#636363'); $('#login_submit').attr('disabled', 'disabled'); $(this).next('div').slideToggle('normal'); }, function() { $('#login_forgotpass').css('background', ''); $('#forgot_pass_link').css('background-position', ''); $('#login_submit').css('background', ''); $('#login_submit').attr('disabled', ''); $(this).next('div').slideUp('normal'); });
[jQuery] unset an array element? (returned via json)
First I have to admit I haven't got a clear understand of js object, array and associative array yet. I'm using jquery form to post a form, and I get back some data in json form, which is an array containing several fields (status, content, etc) The 'content' is an associative array which can have several elements, so I'm able to access it like this: response.content['header'], response.content['body'], response.content ['leftSidebox'], I wonder how I can unset one element in the above array (since i will have to loop through the rest of the elements and update the responding html. I wonder if something like this will work: response.content['header'] = undefined; jQuery.each(response.content, function(i, val) { if(val !== undefined) $(# + i).html(val); });
[jQuery] Re: How to call ClueTip direct and pass the Tip as a parameter
I would like to be able to do something similiar but maybe I am just missing the simple solution for what I really need to do. I want to show a clue tip when the user clicks into textarea box. In the onlclick event I want to pass two parameters to a javascript function that then runs the cluetip and fetches the cluetip content page based on appending the two parameters to the URL. Need to fetch specific database content. SM On Jan 3, 12:01 am, C.Everson c...@bedfordcountyweb.com wrote: Hello, Is it possible to useClueTipin such a manner as to simply call theClueTipand pass it the title and tip as a parameter? I posted a question a few days ago about how to getClueTipto open from a link in an Iframe document so that it opens in the parent window (instead of being clipped at the edge of the IFrame. I have ran across another DHTML tooltip that I can call in this fashion and it DOES work as it needs to, but it is not as nice asClueTip. It uses an OnMouseOver Javascript event to call a function that passes the tip from the link up to the parent window. If I can find out how to callClueTipin this manner, then I may be able to do the same thing with it. Thanks! Chuck
[jQuery] Re: drag and drop fileupload with jquery
Do you mean drag a file from an OS desktop onto a browser window, to initiate an upload? If so and if you're hoping to do this on multiple platforms (OSes) and/or multiple browsers (IE, FF, Safari, Opera), you're going to have to look further than JavaScript. - Richard On Sun, Jan 4, 2009 at 3:02 PM, Jay julien.b...@googlemail.com wrote: hi there, is a drag and drop fileupload with jquery possible? are there existing plugins? thanks in advance jay
[jQuery] Re: jQuery way
Both ways do work, as demonstrated here: http://jsbin.com/eruje/ On Jan 4, 5:53 pm, Dirceu Barquette dirceu.barque...@gmail.com wrote: Thanks a lot! But it doesn't works... :-( I get a really dirty code to add modules. I wish inject a pretty good jQuery code, but is impossible!!! thanks your attention! Dirceu Barquette 2009/1/4 John Resig jere...@gmail.com Maybe: $(#container).children().not(#header, #content, #footer).empty(); --John On Sun, Jan 4, 2009 at 2:05 PM, Dirceu Barquette dirceu.barque...@gmail.com wrote: Hi all! Is there better way? var elem = $('#container')[0]; var arr = [header,content,footer]; jQuery.each(elem.childNodes,function(k,v) { if (jQuery.inArray(v.id, arr) 0) { $(v).empty(); } }) thanks Dirceu Barquette
[jQuery] ClueTip style/css question
I pull a full html page into the cluetip and the top level element which is a table has this style to center it. style=margin-left:5%; width:90%; margin-right:5%; The clue tip centers the content but expands the clue tip background and body past the set width so that there is a chunk to the right that is bigger than the title bar. It looks silly. If I remove that syle the clue tip displays correctly but the content is left aligned. What is the proper way to get the content to align center in the cluetip without making the cluetip box display in-correctly. Thanks! Love the Cluetip and Jquery. Thanks to those who wrote this stuff. I can't believe I waited this long to jump in. SM
[jQuery] Re: How is it possible to have click on each 'a href' menu item and ALSO have another 'a href' trigger as well?
No one is judging you :) It's just that it's *much* easier to help when you provide the actual code your working on. Is there a container for the anchors? Are they siblings or scattered around the page? This stuff is relevant and many simple questions can be skipper when you provide an actual sample of the page. If the anchors are siblings, like this: ul class=menu lia href=#firstFirst/a/li lia href=#secondSecond/a/li /ul div id=movies a href=first.flvFirst movie/a a href=second.flvSecond movie/a /div And you're sure that they are in the exact same order, this would do: $('.menu a').each(function(index){ $(this).click(function(){ // do other stuff $('#movies').eq(index).trigger('click'); }); }); Otherwise you use the already existent attributes: ul class=menu lia href=#firstFirst/a/li lia href=#secondSecond/a/li /ul a href=first.flv class=movieFirst movie/a a href=second.flv class=movieSecond movie/a $('.menu a').click(function(){ var name = $(this).attr('href').substring(1); $('.movie[href*='+name+']').trigger('click'); }); hope that helps. - ricardo On Jan 4, 9:18 pm, yvonney yvonn...@gmail.com wrote: wow fantactic for the replies... This is SO important for me today. I need to keep my menu as it is and I figure it'll be more modular that way. BASED on my lack of skill that is. Then later I can go for something better. I have spent way want way every day on this. And yes, I'm so sorry about what appear to be multiple simplar posts and help requests.. Thing is it's basically one menu that works, and wanting to have videos show up in a sperate div when I click on each existing menu item. So what happened was over the course of trying all the media plugins and other stuff I 'thought' I was getting there, only to find I had to go back and switch plugins again... etc So yea,,, REALLY sorry about all that. I am working hard to become skilled enough and hope to be a better member of this group ASAP. Thank you for your patience. Will write after I think about this. basically I don't care how messy it is... just wanna call the other href WHEN I click on the existing links.. right now the videos show up when I want them to though I have to click on each of the a href's for them... I can add pretty much whatver to the existing menu items... each menu item (that's already there and working) needs to trigger a seperate video... SO: would I add a unique class or unique name to each working menu item (and maybe one to each video a href also?) and then somehow use a jquery little script to call each together with one click each on the working menu. sheesh... any deas? I know it sounds ultimately Un-Elegant... I will become more skilled soon0ish though right now need this to work... can you help with a bit of code? and whether I need to add something unique to the existing menu, as above? AND the video a hrefs I want to bind/call (or?) together? and whatever happens, thank you for your time. sincerely.
[jQuery] Re: How is it possible to have click on each 'a href' menu item and ALSO have another 'a href' trigger as well?
wow Ricardo and everyone... Really kind to write and stuff. And I've actually been really crazed for about 10 days now with my experiements and things changed as I went along. um, hence all the posts. You know what it's like at 3 a.m. I bet! hehehe All fine, thanks for kind comments too, and WOW again for the code and stuff... I'm working towards finding a test space as localhost and virtual machines are now slowing my learning down I think!! ALSO:: I've just these past 3 hours been making more intelligent searches based on the vocabulary used in my last few replies: triggering an anchor's click handler / trigger an event on another element Here's a post I'm reading now which is kinda similar to what I've been looking for for days! Got it based on the meanings learned from you Ricardo, and brian. cool! http://www.nabble.com/Simulate-Link-being-clicked...-td20883531s27240.html best wishes to all...! Gonna be fun to work with your examples now.
[jQuery] jScrollPane initialization problem
Hi guys, I've searched around in jScrollPane threads but can't seem to find what I'm looking for. My site (http://pranshuarya.com/p2) has a bunch of collapsing divs controlled with show() and hide(). The jScrollPane scrollbar shows up the first time around, but after that, when I recall the same function, it doesn't show up. I read that it needs to be reinitialized each time the div changes, and I've worked that into the function so that it gets reinitialized each time the initial_list function is called, like this: var initial_list=function(){ $.get('data.php',function(data){ $(data).find('site').each(function(){ var $entry=$(this) var $site_title=$entry.find('site_title').text() var html_site='li'+$site_title+'/li' $('#sites ul').append($(html_site)) return }) var scroll_pane=function() { $('#sites ul').jScrollPane() } return }) return} But it doesn't seem to work. Does anyone know what I can do to make it work? Thanks.
[jQuery] Re: How is it possible to have click on each 'a href' menu item and ALSO have another 'a href' trigger as well?
Hi Ricardo ... I should have thought to mention (with code below) that I've added id and name to each of the dozen WORKING menu lis. lia id=one1 name=one1 href=#first-atem 1/a/li lia id=one2 name=one2 href=#first-bitem 2/a/li lia id=one3 name=one3 href=#first-citem 3/a/li And I will now add the same I guess to the dozen video player links that I want to trigger one for one, if that's clear enough. 3 examples below. I have add id= and name= JUSt like the menu above which works fine with the 'doing nother yet' id and name additions. NOTE: the class 'media' MUST stay in the links below. How can I trigger item 1 from the above menu and get video 1 to trigger with the same click. a href=vid1.flv id='vid1' name='vid1' class=media video 1/ a a href=vid2.flv id='vid2' name='vid2' class=mediavideo 2/ a a href=vid3.flv id='vid3' name='vid3' class=media video 3/ a I'm feeling that this is all going to come together. GREAT!!
[jQuery] Re: jScrollPane initialization problem
Just to clarify, what I mean by recall the same function is selecting some category from Refine by category and then clicking reset beneath the list of sites, which calls the initial_sites function, which, from my understanding, should reinitialize jScrollPane the way I have structured it. On Jan 4, 8:45 pm, precar pranshua...@gmail.com wrote: Hi guys, I've searched around in jScrollPane threads but can't seem to find what I'm looking for. My site (http://pranshuarya.com/p2) has a bunch of collapsing divs controlled with show() and hide(). The jScrollPane scrollbar shows up the first time around, but after that, when I recall the same function, it doesn't show up. I read that it needs to be reinitialized each time the div changes, and I've worked that into the function so that it gets reinitialized each time the initial_list function is called, like this: var initial_list=function(){ $.get('data.php',function(data){ $(data).find('site').each(function(){ var $entry=$(this) var $site_title=$entry.find('site_title').text() var html_site='li'+$site_title+'/li' $('#sites ul').append($(html_site)) return}) var scroll_pane=function() { $('#sites ul').jScrollPane()} return }) return} But it doesn't seem to work. Does anyone know what I can do to make it work? Thanks.
[jQuery] Re: How to get ClueTip to open in parent document?
Hi Chuck, Sorry I haven't had a chance to look into this yet. I never work with i-frames, so I'm afraid I won't be of much help with the issue. However, you might have success with the $.cluetip.setup() method. Try setting the insertionElement to the parent frame or something like that and see if that works? $.cluetip.setup({ insertionElement: 'whatever' }); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 1, 2009, at 5:12 AM, C.Everson wrote: First off - Happy New Year to everyone! I am trying to use the excellent Cluetip plugin from: http://plugins.learningjquery.com/cluetip to display some content in a hidden DIV on a page that is pulled into context of the main page with an I-frame. I can easily get the content to display in the way I want it to, but the Cluetip is restricted to the boundary of the I-frame. This causes it to get cut off if the activation point is at the edge of the I-frame. I've ran into similar problems with a lightbox and the solution there was to include a target=_parent on the link of the content in the I- frame document. However this does not seem to work for Cluetip. Does anyone have an idea on how to solve or work around this? Thanks! Chuck
[jQuery] Re: How is it possible to have click on each 'a href' menu item and ALSO have another 'a href' trigger as well?
oops! I was thinking it, though forgot to add the question as the reason for the above last post: Would adding the ID and/or NAME to either or both sets of href make it any easier or more logical/modify-able to achieve the goal? That being. example: click menu item 1 and it does what it already does AND also invokes video 1 to play in it's sperate div. The video a hrefs all work though I simply need to have the two events happen at the same time with one trigger of the top/first menu. um, as you already know :--) So, don't I have to have id or name linked up between the two sets of hrefs to get things going?
[jQuery] Re: ClueTip style/css question
Hi, Do you have a demo page somewhere that we can take a look at? A couple suggestions in the meantime: 1. keep the margins but remove the width. 2. move the style rules out of the table element and into a stylesheet, where it'll probably be easier to adjust and override. 3. because of the way the plugin is set up, the tooltip requires an explicit width to be set. if you try setting it to auto, it'll default to 275px. Therefore, it might be easiest for you to just set a fixed width for the table as well. Hope one of those suggestions helps. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 4, 2009, at 10:11 PM, jq noob wrote: I pull a full html page into the cluetip and the top level element which is a table has this style to center it. style=margin-left:5%; width:90%; margin-right:5%; The clue tip centers the content but expands the clue tip background and body past the set width so that there is a chunk to the right that is bigger than the title bar. It looks silly. If I remove that syle the clue tip displays correctly but the content is left aligned. What is the proper way to get the content to align center in the cluetip without making the cluetip box display in-correctly. Thanks! Love the Cluetip and Jquery. Thanks to those who wrote this stuff. I can't believe I waited this long to jump in. SM
[jQuery] Re: How is it possible to have click on each 'a href' menu item and ALSO have another 'a href' trigger as well?
Ricardo !!! Sorry to miss answering your question: YES... the first menu has UL around it... and that MAY be important as each of the THREE menu sections has a TOP item like so. (the id and name that I've added I left in though are not needed currently for this to work. Again: there's 3 sections here the first one. And YES, the videos will be in the exact same order so say, 15 menu items (first 5 below) and 5 in each section. And then for the videos. 15 videos ALL in the same order. The VIDEOS are NOT surrounded in anthing other than a main videos div. NO UL extra LI or anything. There's no reason not to though. Actually would that be best? Then I could hide them perhaps? li a id=onetitle name=onetitle href=#first class=firstSection1Landing/a ul class=first lia id=one1 name=one1 href=#first-asection 1 item 1/a/li lia id=one2 name=one2 href=#first-bSong Writing Session/a/ li lia id=one3 name=one3 href=#first-cITEM first-c/a/li lia id=one4 name=one4 href=#first-dITEM first-d/a/li lia id=one5 name=one5 href=#first-eITEM first-e/a/li /ul /li -- a href=vid1.flv id='vid1' name='vid1' class=media video1/a a href=vid2.flv id='vid2' name='vid2' class=mediavideo2/a a href=vid3.flv id='vid3' name='vid3' class=mediavideo3/a a href=vid4.flv id='vid3' name='vid4' class=mediavideo4/a a href=vid5.flv id='vid3' name='vid5' class=mediavideo5/a NOTE: the class 'media' HAS to remain in the above 5 video hrefs. I could put the videos anyways at all to make it work easier/better. Right now they are just links on the page that work. I guess I should have pointed out the little extra bit, that being the TOP menu's FIRST and main menu item which is name, Section1Landing. As you'd know it's the one that heads up the other 4 items and it should PERHAPS have something happen like a picture or short video occur when it's triggered. Doesn't have to though ... if I'm making things more complicated at this time. Though the video div is empty when the page loads. I'll think about that later. REALLY gonna stay up all night to see if I can get this working... Thanks to all. And thank you Ricardo for this most interesting help/ code. I will work on it now.
[jQuery] Dateformat problem
Hi all, i have tried my best and googled like anything but could not get the solution when i use datepicker (all are in small letters) script type=text/javascript src=/static_media/js/ ui.datepicker.js/script function customRange(input) { return {minDate: (input.id == sd ? $(#ed).datepicker (getDate) : null), maxDate: (input.id == ed ? $(#sd).datepicker(getDate) : null)}; $(#sd,#ed).datepicker({ beforeShow: customRange, showOn: both, }); sd and ed is id of the input box it shows me calendar with prev and next button. but its default format is mm/dd/ which i want to convert in -mm-dd but there wers not function i could found so i tried with Date.format = '-mm-dd'; and thought that could have helped me but could not. but when i use datePicker ('p' in CAPS letters) for which i am using script type=text/javascript src=/static_media/js/datePicker.js/ script function customRange1(input) { return {minDate: (input.id == date-pick2 ? $(#date- pick1).datePicker(getDate) : null), maxDate: (input.id == date-pick1 ? $(#date- pick2).datePicker(getDate) : null)}; date-pick1 and date-pick2 is id of the input box it shows me calendar with next button there is no previous button so i can not go to prev month of the current month. default format is mm/dd/ . when i am writing $.datePicker.setDateFormat('ymd','-'); // unicode its changing my format as i i wanted. but if i choose datepicker thenk i am not able to convert the format to -mm-dd if i choose datePicker then i am not able to go prev month of the current month and i am not getting why Date.format = '-mm-dd'; is not working. please visit this link where i have written the code http://dpaste.com/105471/ all the suggestion would be really appreciable. thanks
[jQuery] Re: ClueTip style/css question
I don't have a demo anywhere and the pages are on a private intranet, wish I had something I could post especially for the future. I kept the margins and ditched the width so that works the best. If there is content then it displays centered, otherwise the no content found message displays to the left. No big deal, my client will live with it. I have the cluetip set to 350px but I really don't want to set the width of the table because I might pull that content page and stuff it into a div on some othe pages, so I want it to grow and shrink dynamically based on the available container. Anyhow, thanks for you quick reply. Another quick question?? I currently have links with names ( some long and some short ) and I want the cluetip to display the tip to the right of the name. I am using leftOffSet $('a.scomments').cluetip({ sticky: true, width:350, positionBy: 'auto', leftOffset: 250, attribute: 'rel', closePosition: 'title', ajaxCache: false }); I thought based on the documentation that the cluetip would position itself from the left side of the anchor, right now it is doing it from the right side of the anchor, so the tip is sometimes over my textarea boxes and sometimes not. When I set the leftoffset high enough to keep it from displaying over the textarea boxes it goes too far right on the real long names. Hope that makes sense. So am I doing something wrong or is this the way it is supposed to work? Thanks, SM On Jan 4, 10:32 pm, Karl Swedberg k...@englishrules.com wrote: Hi, Do you have a demo page somewhere that we can take a look at? A couple suggestions in the meantime: 1. keep the margins but remove the width. 2. move the style rules out of the table element and into a stylesheet, where it'll probably be easier to adjust and override. 3. because of the way the plugin is set up, the tooltip requires an explicit width to be set. if you try setting it to auto, it'll default to 275px. Therefore, it might be easiest for you to just set a fixed width for the table as well. Hope one of those suggestions helps. --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Jan 4, 2009, at 10:11 PM, jq noob wrote: I pull a full html page into the cluetip and the top level element which is a table has this style to center it. style=margin-left:5%; width:90%; margin-right:5%; The clue tip centers the content but expands the clue tip background and body past the set width so that there is a chunk to the right that is bigger than the title bar. It looks silly. If I remove that syle the clue tip displays correctly but the content is left aligned. What is the proper way to get the content to align center in the cluetip without making the cluetip box display in-correctly. Thanks! Love the Cluetip and Jquery. Thanks to those who wrote this stuff. I can't believe I waited this long to jump in. SM- Hide quoted text - - Show quoted text -
[jQuery] Re: jQuery way
Hi Ricardo, Thats right! I know it works. But not with the dirty code of my job, both doesn't work... You are from Brazil like me. Don't you? See the project at: http://calango.barquettenet.net/~dirceu/cva//login:dirceu, password:senha you can click at Adicionar projetos. I injected jQuery at this link. My goal is bypass the dirty code, but... arg. using firebug, change the second index of array to menu_lateral_usuario. It seems like this: var a = $('#container')[0]; var arr = [header,menu_lateral_usuario,footer]; jQuery.each(a.childNodes,function(k,v){ if (jQuery.inArray(v.id,arr) 0){ $(v).empty(); } }) The above code works (imediatly after login...), but: $(#container).children().not(#header, #content, #footer).empty(); //JResig code and $(#container :not(#header, #content, #footer)).empty(); //Kean code Both these very clean codes doesn't work... I don't know why, but can help me in the future. You know for my poor english. I really appreciate your help to explain this problem. We can chat at gmail if you wish... Very special thanks to all! Dirceu Barquette 2009/1/5 Ricardo Tomasi ricardob...@gmail.com Both ways do work, as demonstrated here: http://jsbin.com/eruje/ On Jan 4, 5:53 pm, Dirceu Barquette dirceu.barque...@gmail.com wrote: Thanks a lot! But it doesn't works... :-( I get a really dirty code to add modules. I wish inject a pretty good jQuery code, but is impossible!!! thanks your attention! Dirceu Barquette 2009/1/4 John Resig jere...@gmail.com Maybe: $(#container).children().not(#header, #content, #footer).empty(); --John On Sun, Jan 4, 2009 at 2:05 PM, Dirceu Barquette dirceu.barque...@gmail.com wrote: Hi all! Is there better way? var elem = $('#container')[0]; var arr = [header,content,footer]; jQuery.each(elem.childNodes,function(k,v) { if (jQuery.inArray(v.id, arr) 0) { $(v).empty(); } }) thanks Dirceu Barquette
[jQuery] Re: question about each
wow, thanks for your help, it's really useful to me. On 1月4日, 上午2時56分, Ricardo Tomasi ricardob...@gmail.com wrote: Everytime you change the src attribute of an image, the browser will fire a request to the server. That's one of the reasons why img roll- overs have been replaced with CSS hover a long time ago, this is a waste of scripting. Something like this is much more effective (and semantically correct): (X)HTML: ul class=nav lia href=#about class=aboutAbout/a/li lia href=#product class=productProduct/a/li lia href=#skill class=skillSkill/a/li /ul CSS: .nav a { display:block; text-indent:-px; overflow: hidden; width: 100px; height: 30px; background-repeat: no-repeat; } .about { background-image:url(images/nav/nav_skill.jpg) } .product { background-image:url(images/nav/nav_skill.jpg) } .skill { background-image:url(images/nav/nav_skill.jpg) } .nav a:hover { background-position: 0 -30px } ... Then all you need is 60px high images with both button states, one on top of each other. No preloading, no image swapping, all simple :) A search on google for css rollovers or something alike will give you endless examples. If you still want to do it with javascript, there's a much shorter way: $.each (['about','product','skill','service','news','member','recruit'], function(i, val){ $('img/').attr('src', 'images/nav/nav_' + val + '.jpg') .appendTo(?) .hover(function(){ var $this = $(this); $this.attr('src', $this.attr('src').replace('.jpg', '_over.jpg') ); }, function(){ var $this = $(this); $this.attr('src', $this.attr('src').replace('_over','') ); }); }); You could implement your cacheing with data() there but I think the performance penalty is likely irrelevant. cheers, - ricardo On Jan 3, 12:26 pm, David .Wu chan1...@gmail.com wrote: Part1 var navPath = 'images/nav/'; var navArr = new Array ('nav_about','nav_product','nav_skill','nav_service','nav_news','nav_member','nav_recruit'); var navArrLen = navArr.length; for(i=0;inavArrLen;i++) { $(document.createElement('img')).attr('src',navPath + navArr[i] + '_over.jpg'); } Part2 $('#nav img:gt(0):lt(7)').each(function(i) { $(this).data('btnOver',navPath + navArr[i] + '_over.jpg'); $(this).data('btnOut',$(this).attr('src')); $(this).hover(function() { $(this).attr('src',$(this).data('btnOver')); }, function() { $(this).attr('src',$(this).data('btnOut')); }); }); Part 1 is about to pre load the images Part 2 is to give each image a data property; and do the swap image function when mouse over and out my question is, the image pre load succeed, but when I mouse over the image, the browser will connect to server to require something, is that mean the code do $(this).data('btnOver',navPath + navArr[i] + '_over.jpg'); $(this).data('btnOut',$(this).attr('src')); these tow lines again and again when mouse over?
[jQuery] Re: How is it possible to have click on each 'a href' menu item and ALSO have another 'a href' trigger as well?
Hi Ricardo... After no luck initially with either code I created a smallest possible test page and tried both your examples in various ways including EXACTLY as you posted them. I removed all other scripts, JQ, everything. I did have css for the divs. etc. I double checked everything as there are clear differences between the two examples... div id=movies in the first one class=movie in the second one And NO surrounding DIV in the second example video hrefs. WHAT HAPPENS: In my barest possible tests which is exactly what you posted. When I clicked on either of the: a href=first.flv class=movieFirst movie/a a href=second.flv class=movieSecond movie/a I get: object not found page of course... nothing left to remove for testing... :-))) When I clicked on any of the: ul class=menu lia href=#firstFirst/a/li lia href=#secondSecond/a/li /ul I get NOTHING HAPPENING at all eek! As I am not sure what's what with: 1)$(document).ready(function(){ 2)}); I put them in the script and took them out and tried everything I could. So really I did the 'don't assume anything' thing for two hours No GO Can you double check the code? AND, as always, whatever happens I am totally thrilled to have gotten somewhere on this... thank you very very much! y
[jQuery] Re: question about each
by the way, do you have more sample that css substitute for js? On 1月5日, 下午2時33分, David .Wu chan1...@gmail.com wrote: wow, thanks for your help, it's really useful to me. On 1月4日, 上午2時56分, Ricardo Tomasi ricardob...@gmail.com wrote: Everytime you change the src attribute of an image, the browser will fire a request to the server. That's one of the reasons why img roll- overs have been replaced with CSS hover a long time ago, this is a waste of scripting. Something like this is much more effective (and semantically correct): (X)HTML: ul class=nav lia href=#about class=aboutAbout/a/li lia href=#product class=productProduct/a/li lia href=#skill class=skillSkill/a/li /ul CSS: .nav a { display:block; text-indent:-px; overflow: hidden; width: 100px; height: 30px; background-repeat: no-repeat; } .about { background-image:url(images/nav/nav_skill.jpg) } .product { background-image:url(images/nav/nav_skill.jpg) } .skill { background-image:url(images/nav/nav_skill.jpg) } .nav a:hover { background-position: 0 -30px } ... Then all you need is 60px high images with both button states, one on top of each other. No preloading, no image swapping, all simple :) A search on google for css rollovers or something alike will give you endless examples. If you still want to do it with javascript, there's a much shorter way: $.each (['about','product','skill','service','news','member','recruit'], function(i, val){ $('img/').attr('src', 'images/nav/nav_' + val + '.jpg') .appendTo(?) .hover(function(){ var $this = $(this); $this.attr('src', $this.attr('src').replace('.jpg', '_over.jpg') ); }, function(){ var $this = $(this); $this.attr('src', $this.attr('src').replace('_over','') ); }); }); You could implement your cacheing with data() there but I think the performance penalty is likely irrelevant. cheers, - ricardo On Jan 3, 12:26 pm, David .Wu chan1...@gmail.com wrote: Part1 var navPath = 'images/nav/'; var navArr = new Array ('nav_about','nav_product','nav_skill','nav_service','nav_news','nav_member','nav_recruit'); var navArrLen = navArr.length; for(i=0;inavArrLen;i++) { $(document.createElement('img')).attr('src',navPath + navArr[i] + '_over.jpg'); } Part2 $('#nav img:gt(0):lt(7)').each(function(i) { $(this).data('btnOver',navPath + navArr[i] + '_over.jpg'); $(this).data('btnOut',$(this).attr('src')); $(this).hover(function() { $(this).attr('src',$(this).data('btnOver')); }, function() { $(this).attr('src',$(this).data('btnOut')); }); }); Part 1 is about to pre load the images Part 2 is to give each image a data property; and do the swap image function when mouse over and out my question is, the image pre load succeed, but when I mouse over the image, the browser will connect to server to require something, is that mean the code do $(this).data('btnOver',navPath + navArr[i] + '_over.jpg'); $(this).data('btnOut',$(this).attr('src')); these tow lines again and again when mouse over?
[jQuery] Re: Dateformat problem
I don't understand about the lowercase/uppercase thing. But I do know that datePicker expects the 4-digit format string to be 'yy' not ''. Maybe that's the problem. I do think it *should* be '', though. 'yy' is a bad choice, IMHO. http://docs.jquery.com/UI/Datepicker/%24.datepicker.formatDate On Mon, Jan 5, 2009 at 12:10 AM, Praveen praveen.python.pl...@gmail.com wrote: Hi all, i have tried my best and googled like anything but could not get the solution when i use datepicker (all are in small letters) script type=text/javascript src=/static_media/js/ ui.datepicker.js/script function customRange(input) { return {minDate: (input.id == sd ? $(#ed).datepicker (getDate) : null), maxDate: (input.id == ed ? $(#sd).datepicker(getDate) : null)}; $(#sd,#ed).datepicker({ beforeShow: customRange, showOn: both, }); sd and ed is id of the input box it shows me calendar with prev and next button. but its default format is mm/dd/ which i want to convert in -mm-dd but there wers not function i could found so i tried with Date.format = '-mm-dd'; and thought that could have helped me but could not. but when i use datePicker ('p' in CAPS letters) for which i am using script type=text/javascript src=/static_media/js/datePicker.js/ script function customRange1(input) { return {minDate: (input.id == date-pick2 ? $(#date- pick1).datePicker(getDate) : null), maxDate: (input.id == date-pick1 ? $(#date- pick2).datePicker(getDate) : null)}; date-pick1 and date-pick2 is id of the input box it shows me calendar with next button there is no previous button so i can not go to prev month of the current month. default format is mm/dd/ . when i am writing $.datePicker.setDateFormat('ymd','-'); // unicode its changing my format as i i wanted. but if i choose datepicker thenk i am not able to convert the format to -mm-dd if i choose datePicker then i am not able to go prev month of the current month and i am not getting why Date.format = '-mm-dd'; is not working. please visit this link where i have written the code http://dpaste.com/105471/ all the suggestion would be really appreciable. thanks
[jQuery] Re: jQuery way
What does #container look like? Can you post an example of just that element with its HTML? On Mon, Jan 5, 2009 at 12:53 AM, Dirceu Barquette dirceu.barque...@gmail.com wrote: Hi Ricardo, Thats right! I know it works. But not with the dirty code of my job, both doesn't work... You are from Brazil like me. Don't you? See the project at: http://calango.barquettenet.net/~dirceu/cva//login:dirceu, password:senha you can click at Adicionar projetos. I injected jQuery at this link. My goal is bypass the dirty code, but... arg. using firebug, change the second index of array to menu_lateral_usuario. It seems like this: var a = $('#container')[0]; var arr = [header,menu_lateral_usuario,footer]; jQuery.each(a.childNodes,function(k,v){ if (jQuery.inArray(v.id,arr) 0){ $(v).empty(); } }) The above code works (imediatly after login...), but: $(#container).children().not(#header, #content, #footer).empty(); //JResig code and $(#container :not(#header, #content, #footer)).empty(); //Kean code Both these very clean codes doesn't work... I don't know why, but can help me in the future. You know for my poor english. I really appreciate your help to explain this problem. We can chat at gmail if you wish... Very special thanks to all! Dirceu Barquette 2009/1/5 Ricardo Tomasi ricardob...@gmail.com Both ways do work, as demonstrated here: http://jsbin.com/eruje/ On Jan 4, 5:53 pm, Dirceu Barquette dirceu.barque...@gmail.com wrote: Thanks a lot! But it doesn't works... :-( I get a really dirty code to add modules. I wish inject a pretty good jQuery code, but is impossible!!! thanks your attention! Dirceu Barquette 2009/1/4 John Resig jere...@gmail.com Maybe: $(#container).children().not(#header, #content, #footer).empty(); --John On Sun, Jan 4, 2009 at 2:05 PM, Dirceu Barquette dirceu.barque...@gmail.com wrote: Hi all! Is there better way? var elem = $('#container')[0]; var arr = [header,content,footer]; jQuery.each(elem.childNodes,function(k,v) { if (jQuery.inArray(v.id, arr) 0) { $(v).empty(); } }) thanks Dirceu Barquette
[jQuery] Re: Combo box problem
Hi Link for page is http://www.ennovations.in/rentbhai/test.html u can see code on that page. On Jan 3, 10:11 pm, Vijendra vijendrami...@gmail.com wrote: Thanks mike for your prompt reply but now i am able to display that list but i have to firstly select second or any other option leaving the first one, sorry i cant post that code now but post the link and code tomorrow. On Jan 3, 8:10 pm, Mike Alsup mal...@gmail.com wrote: I am trying to display many lists based on selection in a combo box but can't able to achieve it as when i select any option in combo it displays same list on each option selection. Any help will we welcome and thanks for that help. Can you please post a link? It's hard to help without a link or example code.- Hide quoted text - - Show quoted text -
[jQuery] Re: How to get ClueTip to open in parent document?
On Sun, 4 Jan 2009 23:27:23 -0500, Karl Swedberg wrote: Sorry I haven't had a chance to look into this yet. I never work with i-frames, so I'm afraid I won't be of much help with the issue. However, you might have success with the $.cluetip.setup() method. Try setting the insertionElement to the parent frame or something like that and see if that works? $.cluetip.setup({ insertionElement: 'whatever' }); Hi Karl, Good idea I think, but I can't seem to find the way to reference the parent correctly. I've tried this: $.cluetip.setup({insertionElement: 'window.parent.document.body'}); $('area.load-local').cluetip({ local:true, hideLocal: true, showTitle: true, sticky: false, arrows: false, titleAttribute: 'alt', attribute: 'href' }); }); as well as giving the body tag in the parent a name, then an id and trying to reference them in different ways. It seems to almost work as the ClueTip no longer appears in the Iframe, but it is not appearing in the parent document. BTW - I only have JQuery and Cluetip added to the child document (Iframe). I've tried putting it in both, but that does not seem to matter. I think maybe with the right syntax that your idea could work though. Chuck