[jQuery] Jquery noconflict not working
If you look at the page; http://www.sars-clan.co.uk/forums/ (ignore styling etc as its a work in progress) In the header source the forum system myBB calls prototype and then I call jquery and the noconflict; script type=text/javascript jQuery.noConflict(); jQuery(document).ready(function($){ //my jquery stuff }); /script with all my jquery code inside those tags. However I still get warnings about unknown functions although they are clearly defined in the header, any thoughts?
[jQuery] ajax form plugin submit button
Hello everyone, I have a problem submitting a form tag with submit buttons. many of the scripts used in that page require the name of these submit buttons to work correctly. I already read about the serialize function and submit buttons so tried the form plugin as suggested on the jQuery page but i can't get this to work. On a single site there is no problem using the plugin but the site is only loaded at the beginning, after that everything works with ajax requests and the page is never reloaded. The response of nearly all ajax requests is a new page which is loaded into a draggable div so that the site works like an OS. My problem is that the form tags that are contained in these responses aren't submitted by the plugin, they have their normal function and reload the webpage which is catastrophical for that layout. If you need more information please let me know. Sorry for my english ;-)
[jQuery] Re: google.load issue
Hi David, Google document a nicer way to deal with this in their documentation. The Google API can call a javascript callback when the library you requested has been loaded. http://code.google.com/apis/ajax/documentation/#GoogleLoad Cheers, Alex On Dec 24, 11:44 pm, speedpac...@gmail.com speedpac...@gmail.com wrote: Hi Mike, Sorry for the late response, but thanks a lot for this feedback. It does indeed help. I'm only a bit disappointed that I now have 4 scriptgoogle.load()/ script blocks :) thanks a lot though! David. On 17 dec, 03:08, Michael Geary m...@mg.to wrote: Put your lines of code in separate script tags. google.load() uses document.write() to write a script tag into the document. This script tag is not executed until the current script tag exits. So your jQuery.noConflict() call is being executed before jQuery is loaded. If you break up the script tags like this, it should work fine: script type=text/javascript google.load(jquery, 1); /script script type=text/javascript jQuery.noConflict(); google.load(prototype, 1); /script -Mike On Wed, Dec 16, 2009 at 7:58 AM, speedpac...@gmail.com speedpac...@gmail.com wrote: Hi, For obvious reasons, we try using Google to load javascript libraries when we need them. We already used Prototype using google.load() function, and now we decided to add jQuery as well since we will be using some jQuery UI widgets to speed up development on a project (more specifically we need a decent date selector! Basically, what we did is: google.load(jquery, 1); jQuery.noConflict(); google.load(prototype, 1); Unfortunately, for some reason, it complains that noConflict() is no method leading me to believe tha the jQuery code isn't loaded properly prior to calling the noConflict() method... We have never had such an issue in the past, and if we link directly to the .js file hosted on google servers without using the google.load () method, it works fine as well... Does anyone know this is a known issue when working with google.load ()? Since we manage the needed libraries through a database, and use the google.load() function for all these libraries, it would be a shame if we need to include jQuery library directly without using the google.load() method :) thanks in advance for your very much appreciated feedback! David.
[jQuery] Re: sorting columns using jquery. noob with html and java. built custom php using snmp
You have alot of unclosed tags in there ... Let me help you out a bit and pastebin how it should look!... This should help http://pastie.org/759936 On Dec 28, 6:44 pm, ace123 markay...@gmail.com wrote: I'm not sure if this is possible...but I love the jquery tablesorter- but I can't figure out how to get it working. My page displays as if it's not even there. I used php to snmpget some data from my network switches and routers. It saves it to my DB...then I have this page to display the information from the database. This is where I want to be able to sort, by switch type, software version, etc. I'm not a code guy, just a network engineer trying to make my job easier. Your help please is MUCH appreciated. I've been trying to get this to work off and on for 6 months. This is what I've got so far The page looks something like this when I load it. Host Name Device Type Firmware Version Software Version edge-109c-gs.gov.ntwk 470-24T 3.6.0.7 v3.7.3.13 edge-241c-gs.anx.ntwk 470-24T 3.6.0.7 v3.7.3.13 edge-399c-gs.anx.ntwk 470-24T 3.6.0.7 v3.7.3.13 html body ?php $username=root; $password=; $database=switchesdb; mysql_connect(localhost,$username,$password); mysql_select_db($database) or die( Unable to select database); $query=SELECT * FROM switchcode; $result=mysql_query($query); $num=mysql_numrows($result); ? head script type=text/javascript src=/var/www/html/jquery-1.3.2.js/ script script type=text/javascript src=/var/www/html/ jquery.tablesorter.min.js/script script type=text/javascript $(document).ready(function() { // call the tablesorter plugin $(table).tablesorter({ // enable debug mode debug: true }); });/script table id=table table class=tablesorter cellspacing=1 thead table border=1 cellspacing=4 cellpadding=4 tr thfont face=Arial, Helvetica, sans-serifHost Name/font/th thfont face=Arial, Helvetica, sans-serifDevice Type/font/th thfont face=Arial, Helvetica, sans-serifFirmware Version/font/ th thfont face=Arial, Helvetica, sans-serifSoftware Version/font/ th /tr /thead /head ?php $i=0; while ($i $num) { $host_name=mysql_result($result,$i,host_name); $device_type=mysql_result($result,$i,device_type); $firmware_version=mysql_result($result,$i,firmware_version); $software_version=mysql_result($result,$i,software_version); ? tbody tr tdfont face=Arial, Helvetica, sans-serif?php echo $host_name; ?/font/td tdfont face=Arial, Helvetica, sans-serif?php echo $device_type; ?/font/td tdfont face=Arial, Helvetica, sans-serif?php $cleanstring =strstr($firmware_version, \); echo ($cleanstring); ?/font/td tdfont face=Arial, Helvetica, sans-serif?php $cleanstring1 =strstr($software_version, \); echo ($cleanstring1); ?/font/td /tr /tbody /body /html ?php $i++;} ?
[jQuery] Re: sorting columns using jquery. noob with html and java. built custom php using snmp
Sorry there is a bug / error in the pastebin ... I just noticed that it starts with htmlbody then it calls the head ... tags You will need to take the body tag from the very top and add it directly after the closing /head tag.. My bad!... Also ... tablesorter comes with some CSS to make it look pretty so it might be an idea to include that in the document too - save using ugly (and nearly depreciated) font tags On Dec 29, 4:25 pm, Mark K. Ayler Jr. markay...@gmail.com wrote: Alex, Thanks so much. It does look a lot better...and looking through your changes, it makes perfect sense. Thanks for doing that. Are you sure this code belongs in my .php file or should it be in the jquery.tablesorter.min.js file? $(document).ready(function() { // call the tablesorter plugin $(#results_table).tablesorter({ // enable debug mode debug: true }); });/script On Tue, Dec 29, 2009 at 5:08 AM, Alex Mcauley webmas...@thecarmarketplace.com wrote: You have alot of unclosed tags in there ... Let me help you out a bit and pastebin how it should look!... This should help http://pastie.org/759936 On Dec 28, 6:44 pm, ace123 markay...@gmail.com wrote: I'm not sure if this is possible...but I love the jquery tablesorter- but I can't figure out how to get it working. My page displays as if it's not even there. I used php to snmpget some data from my network switches and routers. It saves it to my DB...then I have this page to display the information from the database. This is where I want to be able to sort, by switch type, software version, etc. I'm not a code guy, just a network engineer trying to make my job easier. Your help please is MUCH appreciated. I've been trying to get this to work off and on for 6 months. This is what I've got so far The page looks something like this when I load it. Host Name Device Type Firmware Version Software Version edge-109c-gs.gov.ntwk 470-24T 3.6.0.7 v3.7.3.13 edge-241c-gs.anx.ntwk 470-24T 3.6.0.7 v3.7.3.13 edge-399c-gs.anx.ntwk 470-24T 3.6.0.7 v3.7.3.13 html body ?php $username=root; $password=; $database=switchesdb; mysql_connect(localhost,$username,$password); mysql_select_db($database) or die( Unable to select database); $query=SELECT * FROM switchcode; $result=mysql_query($query); $num=mysql_numrows($result); ? head script type=text/javascript src=/var/www/html/jquery-1.3.2.js/ script script type=text/javascript src=/var/www/html/ jquery.tablesorter.min.js/script script type=text/javascript $(document).ready(function() { // call the tablesorter plugin $(table).tablesorter({ // enable debug mode debug: true }); });/script table id=table table class=tablesorter cellspacing=1 thead table border=1 cellspacing=4 cellpadding=4 tr thfont face=Arial, Helvetica, sans-serifHost Name/font/th thfont face=Arial, Helvetica, sans-serifDevice Type/font/th thfont face=Arial, Helvetica, sans-serifFirmware Version/font/ th thfont face=Arial, Helvetica, sans-serifSoftware Version/font/ th /tr /thead /head ?php $i=0; while ($i $num) { $host_name=mysql_result($result,$i,host_name); $device_type=mysql_result($result,$i,device_type); $firmware_version=mysql_result($result,$i,firmware_version); $software_version=mysql_result($result,$i,software_version); ? tbody tr tdfont face=Arial, Helvetica, sans-serif?php echo $host_name; ?/font/td tdfont face=Arial, Helvetica, sans-serif?php echo $device_type; ?/font/td tdfont face=Arial, Helvetica, sans-serif?php $cleanstring =strstr($firmware_version, \); echo ($cleanstring); ?/font/td tdfont face=Arial, Helvetica, sans-serif?php $cleanstring1 =strstr($software_version, \); echo ($cleanstring1); ?/font/td /tr /tbody /body /html ?php $i++;} ? -- Mark K Ayler Jr. CCNA, MCSE, NNCSS, OASIS.
[jQuery] Re: How cani achieve this functionality?
Check ajaxrain.com .. they have the perfect example of what you are trying to do. On Dec 29, 4:55 pm, Šime Vidas sime.vi...@gmail.com wrote: The combo is a SELECT element, why shouldn't you be able to write inside it? For every character keyup event, you AJAX load the OPTION elements and put them inside the SELECT:::
[jQuery] JQuery hanging for unknown reason
Hi Everyone, I have built a simple jQuery application (a web based chat app). This works well in Firefox, Chrome, Safari etc... However, in what appears all versions of IE on some pageloads (normally the second or third, but this seems random) once the page is loaded all of the (non- javascript) links stop working. The click noise is heard as they are clicked, but nothing happens. Bizarrely, this only affects links pointing within the same domain - a link to google.com for example continues to work, but a href=/x/a will not. I'm literally tearing my hair out to find the cause of this. Firebug, which is ace, shows everything working. There is a simple .getJSON call left open (which is closed by the server when a new message arrives) but this sometimes works perfectly in IE. I've tried to use the developer tools in IE8, and if I run the profiler I see function calls to function N and also JScript - window script block. I dont know what this is, but I imagine that this might have something to do with it. So my questions are: - What is the best way to tell what the current method being executed in javascript is? (I cant seem to get the call stack or console in IE8 to do anything) - Is there a common newbie mistake in jQuery that can cause this behavior? - If I have to concede defeat myself (i've spent days rewriting this to no avail), does anyone know a cost effective and good jQuery consultant able to do jump in and fix problems / add small features to existing projects? Many thanks, Alex
[jQuery] Re: Jquery + ie7 spans
Sorry found a typo in my example... $(#jlist) ... should read $(#list) This is not an error in the script just an error in copy/paste! On Dec 23, 11:05 am, Alex Mcauley webmas...@thecarmarketplace.com wrote: Morning and happy holidays!.. I am having some trouble with jQuery and IE7 quirks (suprise suprise).. Basically i wrote a script that truncates some text and when More Details is clicked - JQuery unhides the truncated text and adds a Less Details link at the bottom (which inturn hides the revealed text) .. This all works well in FF, Chrome, IE8 (shocker), Safari and pretty much every other browser i have tried. The trouble in IE7 is that the hidden (truncated) text lies in a span tag it wants to put the tag on a new line - quite annoying when it splits a word like this ... [Example - Before more details is clicked] This is some tex.. (More Details) [Example - When More Details is clicked] This is some tex t and here is some more text blah blah (Less Details) Yet in IE8/FF/Etc it looks like this... [Example - Before more details is clicked] This is some tex.. (More Details) [Example - When More Details is clicked] This is some text and here is some more text blah blah (Less Details) I have tried display:inline-block, display:inline and every combination i can think of but i cannot get the text to sit on one line in IE7 only... Here is the mark up... div id=list div class=entry Head of Web Analytics with excellent experience of web analytics and data analysis is required by a leading London based organisation. You should have an excellent grasp of web analytics tools such as Omniture, Hitwise, web trends, google analytics etc. Experience with data analysis, Excel and working with remote teams is also beneficial. If you have team leading experience then this would be advantageous but n span class=show-more-details...a href=/details/21427/More Details/a/span span class=more-details ot essential. Being highly analytical is a must and you should hold some sort of numerical degree. This is a fantastic role for one of Londons most dynamic and forward thinking companies. This is very much a team lead role; you shall be leading a team of online analysts and business analysts. Your role will be to give insight and recommendations for online strategies by analysing web statistics and other statistical information. This is a fantastic role that has massive scope for potential. You shall be working on a lot of exciting projects and you become an integral part of the business. My client is looking to pay a starting salary of between 55 66K + Benefits. a class=show-less-details href=#Less Details/a /span /div /div !-- End #list -- - Here is the jQuery that handles the clicks... $(#list .show-more-details).click(function(ev) { ev.preventDefault(); $(this).hide(); $(this).next(span.more-details).fadeIn(200); }); $(#jlist .show-less-details).click(function(ev) { ev.preventDefault(); var that=this; $(this).parents('.entry span').prev('.show-more-details').fadeIn (200,function(){ $(that).parent('span.more-details').hide(); $(that).parents('.entry span').prev('.show-more-details').show(); // IE8 Fix }); }); As i said it works in every other browser (haven't tested IE6 but i dont care about that)... Has anyone had this problem before and knows a fix ? Thanks in advance Alex
[jQuery] Jquery + ie7 spans
Morning and happy holidays!.. I am having some trouble with jQuery and IE7 quirks (suprise suprise).. Basically i wrote a script that truncates some text and when More Details is clicked - JQuery unhides the truncated text and adds a Less Details link at the bottom (which inturn hides the revealed text) .. This all works well in FF, Chrome, IE8 (shocker), Safari and pretty much every other browser i have tried. The trouble in IE7 is that the hidden (truncated) text lies in a span tag it wants to put the tag on a new line - quite annoying when it splits a word like this ... [Example - Before more details is clicked] This is some tex.. (More Details) [Example - When More Details is clicked] This is some tex t and here is some more text blah blah (Less Details) Yet in IE8/FF/Etc it looks like this... [Example - Before more details is clicked] This is some tex.. (More Details) [Example - When More Details is clicked] This is some text and here is some more text blah blah (Less Details) I have tried display:inline-block, display:inline and every combination i can think of but i cannot get the text to sit on one line in IE7 only... Here is the mark up... div id=list div class=entry Head of Web Analytics with excellent experience of web analytics and data analysis is required by a leading London based organisation. You should have an excellent grasp of web analytics tools such as Omniture, Hitwise, web trends, google analytics etc. Experience with data analysis, Excel and working with remote teams is also beneficial. If you have team leading experience then this would be advantageous but n span class=show-more-details...a href=/details/21427/More Details/a/span span class=more-details ot essential. Being highly analytical is a must and you should hold some sort of numerical degree. This is a fantastic role for one of Londons most dynamic and forward thinking companies. This is very much a team lead role; you shall be leading a team of online analysts and business analysts. Your role will be to give insight and recommendations for online strategies by analysing web statistics and other statistical information. This is a fantastic role that has massive scope for potential. You shall be working on a lot of exciting projects and you become an integral part of the business. My client is looking to pay a starting salary of between 55 66K + Benefits. a class=show-less-details href=#Less Details/a /span /div /div !-- End #list -- - Here is the jQuery that handles the clicks... $(#list .show-more-details).click(function(ev) { ev.preventDefault(); $(this).hide(); $(this).next(span.more-details).fadeIn(200); }); $(#jlist .show-less-details).click(function(ev) { ev.preventDefault(); var that=this; $(this).parents('.entry span').prev('.show-more-details').fadeIn (200,function(){ $(that).parent('span.more-details').hide(); $(that).parents('.entry span').prev('.show-more-details').show(); // IE8 Fix }); }); As i said it works in every other browser (haven't tested IE6 but i dont care about that)... Has anyone had this problem before and knows a fix ? Thanks in advance Alex
[jQuery] Re: not able to receive POST data in php file
Looks like a problem in the PHP/SQL... 1. Make sure $vote is an integer else you will have to wrap it in '' inside the SQL UPDATE statement. 2. The INSERT statement should wrap like this ... INSERT INTO `table_name` (`column1`,`column_2`) VALUES ('$value_1','$value_2') 3. You can save yourself a few lines of code (which you will need to sanitize your input's from the request) by using $insert=mysql_query(INSERT INTO.); if(!$insert) { // means something went wrong exit(Something went wrong ERR: .mysql_error()); } On Dec 21, 11:55 pm, Juan Ignacio Borda juanignaciobo...@gmail.com wrote: try a var_dump($_REQUEST) to see what's being submited. Original Message i am using the following JQuery function to successfully POST data to the user_submit.php file, its just that the php file is unable to receive the data. $(function() { $(#submit_js).click(function() { $.post(user_submit.php, { comment: $(#comment).val() }); }); }); upon finishing the Firebug consoloe shows this: html body Your vote was successfully registered!any text but this /body /html i am pasting the user_submit.php here: ?php $vote = $_REQUEST['vote']; $aid = $vote; //$comment = $_REQUEST['#comment']; //$comment = print_r($_POST); $comment = htmlspecialchars($_POST[comment]); //$comment = $_POST['comment']; //echo htmlspecialchars($comment); //$comment = $_POST['comment']; //echo $comment; // include configuration file include('config.php'); // open database connection $connection = mysql_connect($host, $user, $pass) or die('ERROR: Unable to connect!'); // select database mysql_select_db($db) or die('ERROR: Unable to select database!'); // update vote counter $query = UPDATE answers SET acount = acount + 1 WHERE aid = $vote; $result = mysql_query($query); $cadd = INSERT INTO comments (comment,aid) VALUES ('$comment', '$aid'); mysql_query($cadd); // close connection mysql_close($connection); // print success message echo 'Your vote was successfully registered!'; echo $comment; //print_r(array_count_value($comment)); ? this is the HTML : div id=greetings You are voting out b style=color: #00b0de; id=roadiename/b. Care to explain why?br/br/ textarea name=textarea id=comment cols=38 rows=7textarea/textareabr a href=# id=submit_jsimg src=images/submit.gif style=border: none; float:right; padding-top: 10px;padding-right: 10px;//a /div When I click on Submit, I can see in Firebug console that the data is being POSTed. but i am not receiving that data in the php file. or else i am not able to use it. please help. juanignacioborda.vcf 1KViewDownload
[jQuery] Easy Fade in Problem...
Anyone know why it's not fading in the content? It's fully functional, but it just doesn't fadeIn.. function addPerson() { //current keeps track of how many people we have. var strToAdd = 'div id=input class=ideaInputinput name=idea[] class=idea type=text/' strToAdd += 'textarea name=description[] class=description/ textarea/div' $('#all-inputs').append(strToAdd); }; $(document).ready(function() { $('#btnAdd').click(function () { $(addPerson).fadeIn('slow') }); }); I apologize if this isn't the correct place to post this type of issue. It seems like this would be a great resource.
[jQuery] Re: Easy Fade in Problem...
Wow, thanks! That def. was the trick! On Dec 20, 1:14 pm, brian zijn.digi...@gmail.com wrote: Try putting the fadeIn() where the elements are being appended. Also, use hide() just before that. function addPerson() { //current keeps track of how many people we have. var strToAdd = 'div id=input class=ideaInputinput name=idea[] class=idea type=text/textarea name=description[] class=description/textarea/div'; $('#all-inputs').append(strToAdd).hide().fadeIn('slow'); }; $(document).ready(function() { $('#btnAdd').click(function () { addPerson(); }); }); And, if you don't need to call addPerson() from anywhere else, you could tighten this up even more: $(document).ready(function() { $('#btnAdd').click(function () { var strToAdd = 'div id=input class=ideaInputinput name=idea[] class=idea type=text/textarea name=description[] class=description/textarea/div'; $('#all-inputs').append(strToAdd).hide().fadeIn('slow'); }); }); On Sat, Dec 19, 2009 at 10:27 PM, Alex B alexbadal...@gmail.com wrote: Anyone know why it's not fading in the content? It's fully functional, but it just doesn't fadeIn.. function addPerson() { //current keeps track of how many people we have. var strToAdd = 'div id=input class=ideaInputinput name=idea[] class=idea type=text/' strToAdd += 'textarea name=description[] class=description/ textarea/div' $('#all-inputs').append(strToAdd); }; $(document).ready(function() { $('#btnAdd').click(function () { $(addPerson).fadeIn('slow') }); }); I apologize if this isn't the correct place to post this type of issue. It seems like this would be a great resource.
[jQuery] Help with droppable
Hi there, I'm trying to create some words which can be dragged and dropped into a container (called droppable). I've tried to dynamically create some divs each containing a word, and they can be dragged okay, but when I try to drop, it isnt recognised. I notice that if I have a static div in the script it will be recognised by the droppable area (as per the example on the jquery site) thanks in advance, Alex - Heres the code I have so far: var these = [ 'red', 'blue', 'green', 'orange', 'white' ]; function makeButtons() { for (i in these) makeWord(these[i]); } function makeWord(s) { var e = $(document.createElement('div')); e.attr('id', s); // make a div with id orange / white / etc e.append(s); e.draggable( ); // make this div draggable $('body').append(e); } function initialise(){ makeButtons(); $(function(){ $(#droppable).droppable({ drop: function( ) { alert('dropped'); } }); }); } // html head script type=text/javascript $(document).ready( initialise ); /script /head body div id=droppable /div /body - -- rgds, Alex -
[jQuery] make a dynamic div resizable
Hello there, i'm trying get a div which is dynamically created resizable. the div is created in an ajax request. when i have the div on the page from the start there's no problem, it works fine. only by putting it after the request in another div's body it doesn't work. Here's some of my code. if(isNaN(document.getElementById(frame_id)) == false) { var content_frame = div id=\+frame_id+\/div...; // There's much more ;-) var act_content = document.getElementById ('body_frame').innerHTML; var new_content = act_content+content_frame; document.getElementById('body_frame').innerHTML = new_content; } * Some more checks and validations * $(.action_frame).draggable({ containment: '#body_frame', scroll: false, handle: '.main_frame_title' }); $(#+frame_id).resizable(); Now it's created and here's where I want to make that little ... thing resizable like this. Weird is the object is draggable and it works great but the resizable attribute doesn't aplly. Any suggestions to this? Where's my issue?
Re: [jQuery] Re: Jquery does not work in IE8
Heres the html I'm using. !doctype html html lang=en head titledrag drop/title link type=text/css href=themes/base/ui.all.css rel=stylesheet / script type=text/javascript src=js/jquery-1.3.2.js/script script type=text/javascript src=ui/ui.core.js/script script type=text/javascript src=ui/ui.draggable.js/script script type=text/javascript src=ui/ui.droppable.js/script script type=text/javascript src=script.js/script link type=text/css href=css/demos.css rel=stylesheet / style type=text/css #droppable { background: black; width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; } /style script type=text/javascript $(document).ready( initialise); /script /head body div id=droppable/div /body /html // js var these = [ 'white', 'black', 'orange, 'etc' ]; function makeButtons() { for (i in these) makeWord(these[i]); } function makeWord(s) { var e = $(document.createElement('div')); e.attr('id', s); e.append(s); e.draggable( ); $('body').append(e); } function initialise(){ makeButtons(); $(function(){ $(#droppable).droppable({ drop: function( ) { alert('dropped'); } }); }); }
Re: [jQuery] Re: Jquery does not work in IE8
doh, wrong thread.
[jQuery] Help with draggable / droppable
Hi there, I'm trying to create some words which can be dragged and dropped into a container. I've tried to dynamically create some divs each containing a word, and they can be dragged okay, but when I try to drop, it isnt recognised. thanks in advance, Alex - Heres the code I have so far: var these = [ 'red', 'blue', 'green', 'orange', 'white' ]; function makeButtons() { for (i in these) makeWord(these[i]); } function makeWord(s) { var e = $(document.createElement('div')); e.attr('id', s); // make a div with id orange / white / etc e.append(s); e.draggable( ); // make this div draggable $('body').append(e); } function initialise(){ makeButtons(); $(function(){ $(#droppable).droppable({ drop: function( ) { alert('dropped'); } }); }); } // html head script type=text/javascript $(document).ready( initialise ); /script /head body div id=droppable /div /body -
[jQuery] jQuery helper function access
Hi, there are a couple functions declared in jQuery such as genFx and num, that would be useful in other aspects of jQuery development, and other js activities. They are not attatched to the jQery ovbject. Is there any way currently to access them (me thinks not?), and could they be instead declared as members of a new object such as jQuery.util? Would it be a performace hit, or is there another reason not to expose them? Thanks!
[jQuery] show div hidden
Hi everyone, i'm new on google groups and i'm french, well, i hope i'm at the right place. here's my problem : i'm implanting an easy chat system on my website.(like msn) this is how it works someone open a discussion with someone, he send a message. the message is stored in mysql. the other person had already opened his discussion window. and an ajax script go to get the new message which appear like this : div class=msg aknot31 say blablabli blabla /div In order to, produce special effect. I want these div box to appear with slideDown function of jQuery. The matter is that i don't know how to set him hidden before it slide down
[jQuery] (validate) - How do I validate required fields before form submit
Hi I am trying to use jquery: validation plugin by Jörn Zaefferer. Which works really well I have to say. The one limitation I am trying to work around is how I can run validation for required fields before I submit a form. At the moment I have to submit the form before I see the error messages for required fields I would like to see them prior as the user tabs through the form. Thanks in advance Alex
[jQuery] Help adding a timer to the innerFade plugin ?
Hi everybody. I'm using the innerFade plug in [1] as a news ticker on my site [2], but it will be more usable if i show in a corner of the news area a timer that says to the visitor how much time (in seconds) must wait before it shows the next news. Somebody has done something like this with this plug in? What do you suggest? Thanks in advance for all your help. [1] http://medienfreunde.com/lab/innerfade/ [2] http://www.alexertech.com/ -- Alex Barrios
[jQuery] Using a selector with .load() doesn't execute script?
I'm trying to load one page into another using the .load() method. This loaded page contains a script that I want to execute when it has finished loading. I've put together a simple example to demonstrate: Index.html: html head titleJquery Test/title script type=text/javascript src=script/jquery-1.3.2.min.js/ script script type=text/javascript $(document).ready(function() { $('#nav a').click(function() { $('#contentHolder').load('content.html #toLoad', '', function () {}); return false; }); }); /script /head body div id=nav a href=content.htmlClick me!/a /div hr / div id=contentHolder Content loaded will go here /div /body /html Content.html: div id=toLoad This content is from content.html div id=contentDiv This should fade away. /div script type=text/javascript $('#contentDiv').fadeOut('slow', function() {} ); /script /div When the link is clicked, the content should load and the second paragraph should fade away. However it doesn't execute. It is not just a matter of the DOM not being available, a simple alert() won't execute either. However, if I do away with the #toLoad selector in the .load() call, it works fine. I am not sure why this is, as the script block is clearly in the scope of the #toLoad div? Any ideas? If the script from content.html was in the .load() callback, it works fine. I have worked around the problem by having the callback use .getScript () to load content.js afterwards and have the JS logic in there. This is arguably a more elegant solution anyway, but I'm keen to know *why* the above doesn't work, is it a bug? Thanks!
[jQuery] Re: Modal Dialog with a datepicker inside, works one time, then never...
2009/9/30 Nalum mallon.l...@gmail.com: Hello Alex, The only reason it would be a problem is if you don't apply the jQuery to the input every time it is loaded or if it is loaded a second time and old input is still on the page then you have two elements with the same id. If you have two elements with the same id jQuery wont do anything as it expects that an id is unique. Nalum Well after some testing i change the ID for a Class, a unique class and now works perfect :-D Problem solved ... Thanks again! Cheers!! :D -- Alex Barrios
[jQuery] Re: Modal Dialog with a datepicker inside, works one time, then never...
2009/9/28 alexbariv alexba...@gmail.com Hi everybody. Let me introduce myself. I'm a developer located in Venezuela (latin america), and i have like 2 years using Jquery in every project that came to my hands. Its a pleasure to meet you all. For begin, i have a little problem that i hope you can giveme some light here: I have created a modal dialog inside a tab with a simple form that has a datepicker: div id=tabs-3 style=font-size:11px; div style=padding-left:75%; a href=javascript:void(0) onClick=javascript:{modalForm ('idValuation','destiny.php',$(this).text());} Add Valuation /a /div div id=idValuation style=display:none;padding:2px table tr td valign=topComments: /td tdtextarea type=text name=comment_omit style=width:200px;/textarea/td /tr tr tdDate: /td td script type=text/javascript dateSelector('idFIV'); /script input type=text name=date id=idFIV readonly=true size=10 class=calendario style=border:none /td /tr /table /div /div So, as you can see i call a function dateSelector and this function calls the datePicker like this: function dateSelector(id) { $(document).ready(function() { $(#+id).css({'border':'none','background- color':'#E5E5E5','float':'left'}); $(#+id).datepicker( { showOn: 'button', buttonImage: 'images/iconos/calendar.png', dateFormat:'dd-mm-yy', buttonImageOnly: true }, $.datepicker.regional['es']); }); } The dialog its created like this: function modalForm(id, url, tittle) { if ( !$(#+id).dialog( 'isOpen' ) ){ $(#+id).dialog({ bgiframe : true, closeOnEscape : true, resizable : false, width : 500, modal : true, title : tittle, beforeclose: function(event, ui) { $(this).dialog('destroy'); }, buttons : { 'Cancel' : function() { $(this).dialog('close'); }, 'Add Record' : function() { updateView(''+url+'',''+id+''); $(this).dialog('close'); } } }); $(#+id).dialog('open'); } } This works just perfect, the dialog appear, i can select the date, add a record to the database, and then just call again the dialog using the link. The thing is that when i use this the first time, works perfect, when i try to add a second record, the date picker doesnt refresh the field. It shows the calendar, but when i select a value, this doesnt appear in the input, and even more strange, if i close de dialog and then reopen, it appears the value that i tried to select, selected, but the same problem again. What i am doing wrong with this ? Why works only the first time and then breaks? Thanks in advance for all your help! :-D Hi Again. After some testing, still nothing appears to work. I put a simple calendar and nothing. Could be that this modal its inside the tab plugin also ? -- Alex Barrios
[jQuery] Re: Modal Dialog with a datepicker inside, works one time, then never...
2009/9/29 Nalum mallon.l...@gmail.com: Hello Alex, Is input type=text name=date id=idFIV readonly=true size=10 class=calendario style=border:none loaded in using ajax? If it isn't then you don't need to put the date picker into a function, you could do the following: http://pastebin.com/m4ddcd98b If it is loaded with ajax then you need to call the function every time it is loaded into the page. Hope this helps Nalum Hello Nalum... That's right, that input its loaded with ajax... I use the dateSelector function to unify in one place all the dates that are used in the forms, so if i need to change the format i just do this in one place. Could this be a problem ? Thanks for all your help. -- Alex Barrios
[jQuery] ajax complete function not being called
I'm making a call to a Twitter JSON feed, and when I pass an incorrect username, jQuery's ajax complete method never gets called. An example of a JSON response that causes complete not to be called (nor error, nor success) is: http://twitter.com/users/show.json?screen_name=bhdjbhubeuhfbfbjfbjf Here's my code: $.ajax({ type: GET, url: http://twitter.com/users/show.json;, cache: false, data: screen_name= + $('#account-id').val().replace(/^\s*|\s*$/ g,''), dataType: jsonp, async: true, success: function(j){ alert('success'); }, error: function(xhr, ajaxOptions, thrownError) { alert(xhr + ' ' + ajaxOptions + ' ' + thrownError); }, complete: function() { alert('finished'); } }); Any ideas on why the complete method isn't getting called? Shouldn't this always get called? Thanks!
[jQuery] 'this' keyword in a custom object
Hi... I'm trying to write object-oriented style javascript as follows: - function HtmlFormUtil(formId){ this.formId=formId; this.dirtyInputs=new Array(); } HtmlFormUtil.prototype.trackForChanges=function(){ $(:input,#+this.formId).change(function(){ this.dirtyInputs[this.dirtyInputs.length]=$(this); }); } HtmlFormUtil.prototype.isDirty=function(){ return this.dirtyInputs.length 0; } --- The intention is to use it to track any changes to the form fields... and warn user on window unload, if there's any dirty inputs (i.e form value has changed) Unfortunately, the code above doesnt work... because in this.dirtyInputs[], the this keyword refers to the element that has the value changed (i.e. jquery object), and not 'this instance of HtmlFormUtil'. Has anyone ever done this before? What is the best way to solve my problem above? Thanks in advance for the help! -- Best regards, WiB
[jQuery] Re: jQuery called twice, if I delete one, all jQuery scripts stop working
did you get it to work? On Sep 12, 1:33 pm, Adrian Chen ac...@mac.com wrote: On Sep 12, 10:09 am, Alex Weber alexwebe...@gmail.com wrote: That's totally weird! I would start over, delete all the include files and add it once before any other external js script. Test it and gradually add the others one by one afterwards... This is really a weird problem, its the best I can think of because this hasn't happened to me!! Also, re-download jQuery and check for any conflicts the other files might have. Try calling jQuery.noConflict() at any point after jQuery and the other libraries have been loaded! Alex After some testing, found out the culprit; one of the js files that were in the list. I got no clue what could be triggering it, this is the code inside the js file that is giving the issue: var j = jQuery.noConflict(); j(document).ready(function() { j('a#content-link').click(function() { j('#content-div').toggle(400); return false; }); }); That's from this scripthttp://www.studioyucca.com/2008/10/03/hideshow-content-with-jquery/
[jQuery] Re: Selects populating other selects from JSON data
Hey, two suggestions: First off, if you're using JSON data to populate it then I assume the data will come from an external source and you are only generating it in your script for testing purposes. In that case, perfect. If not, and the data is actually hard-coded, then you shouldn't really be doing it like this! Finally, what I would do and its really just matter of preference, instead of doing this: $(select[name='model']).empty(); $.each(model, function (){ $(select[name='model']).append('option value=' + this + '' + this + '/option') }); } I would do the following: var options = ''; $.each(model, function (){ html += 'option value=' + this + '' + this + '/option'); }); $(select[name='model']).html(options); It should increase the performance because you cache all the data in a variable and insert it into the select in one step, instead of appending it during each iteration. Using html() will overwrite the previous contents too, so no need to use empty() either. Cheers, Alex On Sep 12, 12:48 am, Steffan A. Cline stef...@hldns.com wrote: on 9/11/09 8:02 PM, Steffan Cline at stef...@hldns.com wrote: on 9/11/09 5:15 PM, Steffan Cline at stef...@hldns.com wrote: Perhaps I am not Googling correctly to find the data I am after. I want to have a select that upon making a choice will add elements to a second select. I've seen code to do this using ajax calls but what if I embed the data into the page in a JSON format? I am looking for a good example of this. Anyone seen one? Ok, getting closer: $(document).ready(function () { var items = { Aquatech : [Canon 5D Mark II,Nikon D3,Nikon D3x,Canon 1D,Canon 1Ds,Canon 1Ds Mark II,Canon 1Ds Mark III,Canon 1D Mark III,Canon 30D,Canon EOS 5D,Canon 20D,Nikon D200,Nikon D700,Canon 40D,Canon 50D,Nikon D300], Canon : [Canon HF20,Canon SD800,Canon A570,Canon G10,Canon G11], Ikelite : [Olympus FE-360,Canon 20D,Canon Rebel 350 / XT,Nikon D300,Canon Rebel 400 / XTi,Canon 30D,Canon 5D,Nikon D200,Nikon D40,Nikon D40x,Nikon D60,Olympus SP-510,Olympus E-500,Canon G9,Nikon P5000,Nikon P5100,Nikon D80,Nikon D90,Nikon P6000,Nikon D700,Canon 40D,Canon 50D,Canon G10,Canon 5D Mark II,Canon Rebel 500 / T1i,Canon Rebel 450 / XSi], Sony : [Sony W300] }; $.each( items, function(brand){ $(select[name='manufacturer']).append('option value=' + brand + '' + brand + '/option'); }); $(select[name='manufacturer']).change( function(){ $ }); }); So, that is populating the first. Great. Now, it's a matter of finding the chosen value and then adding the elements of the array to the select. A nudge anyone? This is ugly but works. Any suggestions on how to shorten it? $(document).ready(function () { var items = { Aquatech : [Canon 5D Mark II,Nikon D3,Nikon D3x,Canon 1D,Canon 1Ds,Canon 1Ds Mark II,Canon 1Ds Mark III,Canon 1D Mark III,Canon 30D,Canon EOS 5D,Canon 20D,Nikon D200,Nikon D700,Canon 40D,Canon 50D,Nikon D300], Canon : [Canon HF20,Canon SD800,Canon A570,Canon G10,Canon G11], Ikelite : [Olympus FE-360,Canon 20D,Canon Rebel 350 / XT,Nikon D300,Canon Rebel 400 / XTi,Canon 30D,Canon 5D,Nikon D200,Nikon D40,Nikon D40x,Nikon D60,Olympus SP-510,Olympus E-500,Canon G9,Nikon P5000,Nikon P5100,Nikon D80,Nikon D90,Nikon P6000,Nikon D700,Canon 40D,Canon 50D,Canon G10,Canon 5D Mark II,Canon Rebel 500 / T1i,Canon Rebel 450 / XSi], Sony : [Sony W300] }; $.each( items, function(brand){ $(select[name='manufacturer']).append('option value=' + brand + '' + brand + '/option'); }); $(select[name='manufacturer']).change( function(x){ var man = this.value; $.each( items, function(brand, model){ if(brand==man) { $(select[name='model']).empty(); $.each(model, function (){ $(select[name='model']).append('option value=' + this + '' + this + '/option') }); } }); }); }); Thanks Steffan
[jQuery] Re: IDE supporting jQuery
I use linux and I gotta say Aptana has come a long way recently... it was really slow and put me off a few months ago but now it's about the same as Netbeans... both are kind of clunky to initialize but after that they are fine! What I love in Netbeans is that you can get intellisense-style code completion for jquery if you include the fully-documented version: http://jqueryjs.googlecode.com/files/jquery-1.3.2-vsdoc2.js However, personally, I prefer editing using gedit + plugins. Its less bureaucratic in terms of having to creating a project for every file you edit, etc. Plus, with plugins, you can customize it to become quite powerful! No code-completion for jquery as far as I know though. Alex On Sep 11, 1:02 pm, KirbySaysHi imjustthepianopla...@gmail.com wrote: NetBeans ftw! For JavaScript and PHP, it's probably the best around. Last time I used aptana, it seemed very slow, that was a year ago or so. On Sep 11, 9:20 am, Alex Weber alexwebe...@gmail.com wrote: Just confirming: Aptana and Netbeans are excellent choices! :) On Sep 11, 8:15 am, szymon jankowski szymon.jankow...@gmail.com wrote: NetBeans IDE also has jquery support. best regards, SJ On Sep 10, 7:58 pm, MorningZ morni...@gmail.com wrote: Are you looking for something where Intellisense would work for jQuery? Something else? Open source so it's free or some other reason? A lot will depend on what you use for server side code so you don't have two IDE's to mess with On Sep 10, 11:41 am, Saga rgk.su...@gmail.com wrote: is there any IDE supporting jQuery..i prefer some open source IDE...pls suggest me on
[jQuery] Re: jQuery called twice, if I delete one, all jQuery scripts stop working
That's totally weird! I would start over, delete all the include files and add it once before any other external js script. Test it and gradually add the others one by one afterwards... This is really a weird problem, its the best I can think of because this hasn't happened to me!! Also, re-download jQuery and check for any conflicts the other files might have. Try calling jQuery.noConflict() at any point after jQuery and the other libraries have been loaded! Alex On Sep 12, 11:33 am, Adrian Chen ac...@mac.com wrote: I got this at the bottom of a website: script type=text/javascript src=/js/jquery.js/script script type=text/javascript src=/js/jquery.cycle.all.js/script script type=text/javascript src=/js/slider.js/script script type=text/javascript src=/js/newnav.js/script script src=/js/jquery.js type=text/javascript/script script type=text/javascript src=/js/whymac.js/script If you notice, jquery is called twice. If I delete either one, anything that works with jQuery stops working.
[jQuery] Re: IDE supporting jQuery
Just confirming: Aptana and Netbeans are excellent choices! :) On Sep 11, 8:15 am, szymon jankowski szymon.jankow...@gmail.com wrote: NetBeans IDE also has jquery support. best regards, SJ On Sep 10, 7:58 pm, MorningZ morni...@gmail.com wrote: Are you looking for something where Intellisense would work for jQuery? Something else? Open source so it's free or some other reason? A lot will depend on what you use for server side code so you don't have two IDE's to mess with On Sep 10, 11:41 am, Saga rgk.su...@gmail.com wrote: is there any IDE supporting jQuery..i prefer some open source IDE...pls suggest me on
[jQuery] Re: how can I treat a string as JSON?
Thanks again Michael! I changed that particular line to use eval() and it works just the same... saved me an external js with 50 lines or so, great stuff! :) Thanks for the svn link too, I doubt I'll be using it regularly but always good to know what's cooking! On Sep 9, 12:57 am, Michael Geary m...@mg.to wrote: Glad to help, Alex. Some people say eval() is evil, but it isn't. Like any powerful tool, it has certain characteristics that can be good or bad, depending. The 1.3.3-style code is certainly better, using either JSON.parse if it's available or else the Function constructor. The Function constructor is basically just another flavor of eval(), but by chance it happens that eval() can be rather slow if Firebug is running, but the Function constructor doesn't slow down the same way. I don't know when 1.3.3 will be released, but you can always check out the code from Subversion if you want to see the very latest: http://jqueryjs.googlecode.com/svn/trunk Or if you want *all* the tagged versions: http://jqueryjs.googlecode.com/svn -Mike On Tue, Sep 8, 2009 at 6:39 PM, Alex Weber alexwebe...@gmail.com wrote: Thanks for that Michael! I guess I've heard so many eval() horror stories that I automatically decided against it... BTW what's this 1.3.3 talk? I thought it was supposed to be released last month? ;) Alex On Sep 8, 5:11 am, Michael Geary m...@mg.to wrote: Why do you not want to use eval()? That's what jQuery 1.3.2 does in $.getJSON and $.ajax: // Get the JavaScript object, if JSON is used. if ( type == json ) data = window[eval](( + data + )); Or better, you can use this code from jQuery 1.3.3: // Get the JavaScript object, if JSON is used. if ( type === json ) { if ( typeof JSON === object JSON.parse ) { data = JSON.parse( data ); } else { data = (new Function(return + data))(); } } -Mike On Mon, Sep 7, 2009 at 11:02 PM, Alex Weber alexwebe...@gmail.com wrote: I use $.getJSON for all my ajax stuff and it works beautifully but there is one particular situation where I use an iframe hack to do an ajax file upload and even though the returned value is a json object (created with PHP), jQuery treats it like a string. I'm using json2.js right now and it does the trick but I don't like including that much extra code because of one rare situation. So my question is, be it with $.getJSON or by specifying 'json' as the expected return type of an ajax request, jQuery *seems* to be able to convert into json. The string returned is already a json object, I just need jQuery to be able to treat it like one. I've tried wrapping it in a jQuery object but no use. (and I really don't want to go down the eval() path)... Any suggestions? Thanks!!
[jQuery] Re: post an array
You can't post a javascript object, its gotta be key-value pairs if the data is coming from a form you can do: var serial = $('#myform').serialize(); and post the variable serial if not then as far as I know you gotta convert the object into key- value pairs some other way! On Sep 9, 6:13 am, Adonis achrysoch...@hotmail.com wrote: Hi, I can not upload an array to the server... I am using this: $.post(/addPolyline/, {project_name:project_name, polyline_coordinates:vertexArray}, function(data){ alert(Done); }); project_name is a string. The vertexArray contains coordinates so it could look like this: [(-11.2323,34.3455),(12.2323,34.3455),(18.2323,-78.3455), (13.2323,35.3455)]. The server side is fine because it works if i do not send the array. I tried different syntax such as the site recommends(e.g 'polyline_coordinates[]':vertexArray) but still it does not work... Any ideas?
[jQuery] Re: tooltips not working on content loaded via ajax
I'm not sure I understand completely, if you mean that the tooltip doesnt work with elements dynamically generated via load(), then it could be a binding issue... try binding an alert() and see if that works. in case it doesn't its because when the event was bound the elements didn't exist... the solution is to use live(): $('.tooltipElement').live(..) On Sep 9, 1:46 am, Canadaka canad...@gmail.com wrote: I have some simple tooltips on my site that load the content of the title tag into the tooltip. I am currently using this pluginhttp://cssglobe.com/post/4380/easy-tooltip--jquery-pluginbut I have tried several others. They all work fine for static elements, but the main content of my pages are loaded by an ajax load() call. The tooltips don't work on any this content loaded via ajax. Why is this happening and is there a way to fix this? Or maybe a tooltip plugin that will work for this?
[jQuery] how can I treat a string as JSON?
I use $.getJSON for all my ajax stuff and it works beautifully but there is one particular situation where I use an iframe hack to do an ajax file upload and even though the returned value is a json object (created with PHP), jQuery treats it like a string. I'm using json2.js right now and it does the trick but I don't like including that much extra code because of one rare situation. So my question is, be it with $.getJSON or by specifying 'json' as the expected return type of an ajax request, jQuery *seems* to be able to convert into json. The string returned is already a json object, I just need jQuery to be able to treat it like one. I've tried wrapping it in a jQuery object but no use. (and I really don't want to go down the eval() path)... Any suggestions? Thanks!!
[jQuery] Re: how can I treat a string as JSON?
Thanks for that Michael! I guess I've heard so many eval() horror stories that I automatically decided against it... BTW what's this 1.3.3 talk? I thought it was supposed to be released last month? ;) Alex On Sep 8, 5:11 am, Michael Geary m...@mg.to wrote: Why do you not want to use eval()? That's what jQuery 1.3.2 does in $.getJSON and $.ajax: // Get the JavaScript object, if JSON is used. if ( type == json ) data = window[eval](( + data + )); Or better, you can use this code from jQuery 1.3.3: // Get the JavaScript object, if JSON is used. if ( type === json ) { if ( typeof JSON === object JSON.parse ) { data = JSON.parse( data ); } else { data = (new Function(return + data))(); } } -Mike On Mon, Sep 7, 2009 at 11:02 PM, Alex Weber alexwebe...@gmail.com wrote: I use $.getJSON for all my ajax stuff and it works beautifully but there is one particular situation where I use an iframe hack to do an ajax file upload and even though the returned value is a json object (created with PHP), jQuery treats it like a string. I'm using json2.js right now and it does the trick but I don't like including that much extra code because of one rare situation. So my question is, be it with $.getJSON or by specifying 'json' as the expected return type of an ajax request, jQuery *seems* to be able to convert into json. The string returned is already a json object, I just need jQuery to be able to treat it like one. I've tried wrapping it in a jQuery object but no use. (and I really don't want to go down the eval() path)... Any suggestions? Thanks!!
[jQuery] Re: WP-Cumulus
Its definitely possible although it would probably not run so smooth on anything but the latest generation of browsers due to the heavy-ish JS required... I've never seen anything like it done but Dynacloud is a very good tag cloud plugin for jQuery, it could be a good starting point! On Sep 8, 4:11 am, ykb yadu.ma...@gmail.com wrote: Is it possible to create an animated tag cloud like WP-Cumulus using javascript? Does anyone know of any plug-in that can emulate WP-Cumulus? [ See:http://www.bloggerbuster.com/2008/08/blogumus-flash-animated-label-cl... andhttp://wordpress.org/extend/plugins/wp-cumulus/] Thanks.
[jQuery] possible to override inline onchange() event?
I have a select box with an inline onchange() event that reloads the page. Using jQuery I've created a $('#myForm select').live('change', function (e){...}) event handler to intercept the onchange() behavior and even though I have e.preventDefault() and e.stopPropagation() after my jquery event runs the inline onchange() is still triggered... Am I missing something here? I realize I could easily remove the onchange() from the code but ideally I shouldn't edit the HTML directly and just override it using jquery... Thanks!
[jQuery] ancestor descendant selector is much slower than parent child when used in find() in large page
I have found that row.find(td.someClass span.otherClass) is significantly slower than row.find(td.someClass span.otherClass). Performance of the ancestor/descendant selector is linearly dependent on the amount of other elements on the page, outside the row element, whereas the parent/child selector is unaffected. This suggests that the ancestor/descendant query is parsing elements outside of the row, even though the query should be scoped to the row. Is this expected, or is this something that can be improved in the jQuery selector engine? Specifically, I have the following conditions: * row is a jQuery wrapped set containing one tr element * There are many rows in the table containing the row * There is a small number of cells in the row, of which one has class someClass (so the scope of the query is small) * Every td in the row contains span class='otherClass' some text / span and no other content. One child, no grandchildren. There is not a large tree of descendant elements to search, so there's no obvious reason why searching descendants should be slower than searching children. * The number of rows in the table affects performance of the ancestor/ descendant selector linearly, but does not affect the parent/child selector. This suggests that the ancestor/descendant query is parsing the whole table. With 5 cells in each row, one of which has someClass, I get the following results. With 100 rows, the Firebug profiler reports an average of 110ms for row.find(td.someClass span.otherClass) and 0.673ms for row.find (td.someClass span.otherClass). With 1000 rows, the Firebug profiler reports an average of 1080ms for row.find(td.someClass span.otherClass) and 0.726ms for row.find (td.someClass span.otherClass). With 4000 rows, the Firebug profiler reports an average of 4623ms for row.find(td.someClass span.otherClass) and 0.753ms for row.find (td.someClass span.otherClass). This gist contains a page demonstrating the problem. http://gist.github.com/170290
[jQuery] Re: jquery accordion inside the jquery tabs
I can solve this problem insert tha follow instruction : if (isNaN(g)) g = 0; afer if (l.prop == height) { g = (l.now - l.start) / (l.end - l.start); } so ... step: function(k, l) { if (l.prop == height) { g = (l.now - l.start) / (l.end - l.start); } if (isNaN(g)) g = 0; j.toShow[0].style[l.prop] = (g * d [l.prop].value) + d[l.prop].unit; }, ...
[jQuery] Superfish: some floated elements show through the menu
Hi, hopefully someone can help with this problem - see http://www.cosmiccupiddating.com If you hover over help in the menu in Internet Explorer, you can see the Advanced Search link does not disappear when the menu drops down. This wouldn't be so bad but it happens on other pages too, especially in the logged in area. I've tried calling bgiFrame. I've also tried setting z-index's in different places all over the css, but nothin seems to make a difference, if anyone can help I'll be massively greatful. Thanks, Alex
[jQuery] blockUI does work
Hi all, I tried on blockUI and the below doesn't work? Any help please? Thanks. html head link rel=stylesheet href=styles.css type=text/css media=all script src=jquery.js/script script src=jquery.blockUI.js/script script $(document).ready(function() { $(div#menu li).click(function() { $('div.blockMe').block({ message: null }); var type = ($(this).attr(id)); $(this).toggleClass(selected); $(this).siblings(li).removeClass(selected); var img = new Image(); $(img).load(function () { $(this).hide(); $('#locationmap').html(this); $(this).fadeIn(); }).error(function () { $('#locationmap').html('No image loaded'); }).attr('src', type+'map.jpg'); }); }); /script script type=text/javascript $(document).ready(function() { $('#blockButton').click(function() { $('div.blockMe').block({ message: null }); }); $('#blockButton2').click(function() { $('div.blockMe').block({ message: 'h1Processing.../h1', css: { border: '3px solid #a00' } }); }); $('#unblockButton').click(function() { $('div.blockMe').unblock(); }); $('a.test').click(function() { alert('link clicked'); return false; }); }); /script /head body p input id=blockButton type=submit value=Block / input id=blockButton2 type=submit value=Block with Message / input id=unblockButton type=submit value=Unblock / /p div id=menu ul li class=selected id=sabahspanSabah/span/li li id=kkspanKota Kinabalu/span/li li id=labuanspanLabuan/span/li /ul /div div id=locationmap class=blockMeimg id=mapimage src=sabahmap.jpg/img/div /body /html
[jQuery] load spinner not working
Hi all, Need a little help from you guys here. I tried to show load spinner will ajax doing its work on a complex page item load. In my case I am trying to load a large image and at the same time load large amount of data onto a table. But it only works in FireFox 3 but it doesn't works on FireFox2, IE6, and IE7. I have done a sample to simulate what I am trying to do. Please download the sample zipped file from the link below, take a look and run the file on those browsers. You will see what I mean. http://www.mediafire.com/?sharekey=cba41bca4e108e1ced24a2875c7fa58ee04e75f6e8ebb871 Hope someone can help. Thanks! Alex
[jQuery] Re: Pasing flash media, with multiple instances on one page.
In case others are looking for a similar solution I found something that suited what i needed. http://www.tagtooga.com/tapp/db.exe?c=pgf=FlashMp3Player Stops other players when a new one starts. Perfect! On May 20, 3:54 pm, Alex alexze...@gmail.com wrote: Hello, so here's my issue. I'm just the jquery.mediaplugin. Withmultipleplayers being used for each mp3 link. Is there a way I can setup a jquery call that knows to pause (or stop) all other players once a user click on a new player?
[jQuery] Re: Confusing and probably inaccurate documentation for noConflict()
Okay, so it's simple, and it's not advised to mix libraries. However, the documentation is still confusing as heck - just thought I'd like someone know. On Jun 5, 2:29 pm, Ricardo ricardob...@gmail.com wrote: jQuery saves the '$' object on init, if it exists. noConflict() 'returns' it to the old owner. Passing true the 'jQuery' object is also freed. There's not much to it: jQuery.extend({ noConflict: function( deep ) { window.$ = _$; if ( deep ) window.jQuery = _jQuery; return jQuery; }, On Jun 5, 12:06 pm, Alex Ehlke capt...@gmail.com wrote: The online documentation for jQuery.noConflict() seems to be incorrect, or ambiguous at best. Here is the text I'm referring to, fromhttp://docs.jquery.com/Core/jQuery.noConflict: NOTE: This function must be called after including the jQuery javascript file, but before including any other conflicting library, and also before actually that other conflicting library gets used, in case jQuery is included last. There are several problems here. The second and also clause seems to actually be an alternative, not an additional requirement. This needs rewording, since it seems to imply it's also a requirement -- but it's impossible to include jQuery last, yet call jQuery.noConflict() before including other libraries, so clearly this needs to be rewritten. Also, there is a link on that page tohttp://docs.jquery.com/Using_jQuery_with_Other_Libraries which says that if jQuery is included last, noConflict() is unnecessary (again, despite what the noConflict() documentation says).
[jQuery] Re: Remove links but not images
Thanks for all the help folks - problem sorted out now - I appreciate it. Take care Alex On 9 June, 16:11, mkmanning michaell...@gmail.com wrote: For the example markup you give it's very simple, just do this: $('ul li a').each(function(){ $(this).replaceWith( $(this).children() ); }); On Jun 9, 6:26 am, Adardesign adardes...@gmail.com wrote: Run a .each() to retrieve the images, and delete .remove() the images and place them into a var. Then remove all li gt(0) greater then and replace them into one li It should be doable... On Jun 9, 9:07 am, Armand Datema nok...@gmail.com wrote: mm i dont know if this is the best way but you could try $(ul a#click).onclick = function() { return false; } and then on that link you set a style class with the standard cursor Its a workaround but it works On Tue, Jun 9, 2009 at 2:13 PM, alex alex_bille...@hotmail.com wrote: Hi folks This has me stumped. I have a list of images and I want to remove the links but retain the images. So this ul lia href=fooimg src=path/to/image1 //a/li lia href=fooimg src=path/to/image2 //a/li etc etc /ul Becomes this ul liimg src=path/to/image1 //li liimg src=path/to/image2 //li /ul Using this $('ul a').remove(); does not work as it also removes the images as well. Any help would be much appreciated. Thanks in advance. Alex -- Armand Datema CTO SchwingSoft
[jQuery] Re: Remove links but not images
Thanks for all the help folks - problem sorted out now - I appreciate it. Take care Alex On 9 June, 16:11, mkmanning michaell...@gmail.com wrote: For the example markup you give it's very simple, just do this: $('ul li a').each(function(){ $(this).replaceWith( $(this).children() ); }); On Jun 9, 6:26 am, Adardesign adardes...@gmail.com wrote: Run a .each() to retrieve the images, and delete .remove() the images and place them into a var. Then remove all li gt(0) greater then and replace them into one li It should be doable... On Jun 9, 9:07 am, Armand Datema nok...@gmail.com wrote: mm i dont know if this is the best way but you could try $(ul a#click).onclick = function() { return false; } and then on that link you set a style class with the standard cursor Its a workaround but it works On Tue, Jun 9, 2009 at 2:13 PM, alex alex_bille...@hotmail.com wrote: Hi folks This has me stumped. I have a list of images and I want to remove the links but retain the images. So this ul lia href=fooimg src=path/to/image1 //a/li lia href=fooimg src=path/to/image2 //a/li etc etc /ul Becomes this ul liimg src=path/to/image1 //li liimg src=path/to/image2 //li /ul Using this $('ul a').remove(); does not work as it also removes the images as well. Any help would be much appreciated. Thanks in advance. Alex -- Armand Datema CTO SchwingSoft
[jQuery] Selecting previous element
How do I apply a class to the previous element that's being hovered? Basically the opposite to the following CSS selector: #mynav li.current + li { background:black; } Which would make the li next to the one with a class of 'current' have a black background. Effectively something like: #mynav li.current - li { background:black; } Which would do the same, but to the element immediately before this one. This is impossible with CSS, how would I select it using jQuery? Many thanks, Alex
[jQuery] Confusing and probably inaccurate documentation for noConflict()
The online documentation for jQuery.noConflict() seems to be incorrect, or ambiguous at best. Here is the text I'm referring to, from http://docs.jquery.com/Core/jQuery.noConflict : NOTE: This function must be called after including the jQuery javascript file, but before including any other conflicting library, and also before actually that other conflicting library gets used, in case jQuery is included last. There are several problems here. The second and also clause seems to actually be an alternative, not an additional requirement. This needs rewording, since it seems to imply it's also a requirement -- but it's impossible to include jQuery last, yet call jQuery.noConflict() before including other libraries, so clearly this needs to be rewritten. Also, there is a link on that page to http://docs.jquery.com/Using_jQuery_with_Other_Libraries which says that if jQuery is included last, noConflict() is unnecessary (again, despite what the noConflict() documentation says).
[jQuery] context issues when using $.ajax please help!
I'm having problems returning values from within functions that make use of $.ajax functions For example: var obj = { this.foo = 'foo', this.bar = function(variable){ $.post('myscript.php', 'var='+variable, this.callback, 'json'); }, this.callback = function(json){ // this.foo is undefined!! if(json.msg == this.foo) alert('foo'); } } ok its a stupid example but basically I cannot I lose my context when I run $.post (or $.get/$.ajax). the callback, whether anonymous or not is limited to the $.post context and i can't access my object's variables and methods on the same note I can't return any values from within $.post either $.post always returns a XMLHTTPRequest object. and for some reason this.bar() doesnt return anything if i were to add a return statement based on the value received from the $.post this is killing me!! sorry if its not too clear , well it is to me but ive been working on this for hours... thanks Alex
[jQuery] Pasing flash media, with multiple instances on one page.
Hello, so here's my issue. I'm just the jquery.media plugin. With multiple players being used for each mp3 link. Is there a way I can setup a jquery call that knows to pause (or stop) all other players once a user click on a new player?
[jQuery] jquery pause all flash player elements, allow only one to play.
I'm using the jquery.media plugin. On the page i have it has 20 or so flash elements to play each different mp3 files. Is there any way to setup a jquery call so when you click play on the flash element it pauses any other flash player running?
[jQuery] Re: jQuery XML
OK, so now I have a new method of going about things and I'm so nearly there, but can't get it working. I'm using this piece of Javascript modified from a d'bug post http://itiz.in/12u7 If I remove the medium from the mix, I get an alert box with all three image URLs, no spaces. If I add medium (which is the size I need) I get no response, and Safari's Web Inspector says TypeError: Result of expression 'attribute[Image]' [undefined] is not an object.. I just need to grab that medium image URL, but it's proving very hard!
[jQuery] jQuery XML
I have this XML file, and I've gotten a few values from it, but I need one more, a create a variable from it, and insert that in to an img tag. XML : http://itiz.in/idvt JS : http://itiz.in/318m So as is clear, getting the track name etc. is fine, but I want the medium sized album art to be inserted in to an img tag (img src=medium_sized_image_url alt=). I've tried searching but can't find anything, I'm doubly interested because I wouldn't mind using the URL that's in there as well.
[jQuery] Re: jQuery XML
Solved the URL thing, that was me being lazy and not thinking hard enough $('p.track').append(a href=\ + $(this).find(url).text() + \ + $(this).find(name).text() + /a); That thankfully means that I'll be able to embed the image, but I'm still not sure how to select it. I've tried find(image size=\medium \) but it didn't work. On May 20, 5:51 pm, alex boba...@googlemail.com wrote: I have this XML file, and I've gotten a few values from it, but I need one more, a create a variable from it, and insert that in to an img tag. XML :http://itiz.in/idvt JS :http://itiz.in/318m So as is clear, getting the track name etc. is fine, but I want the medium sized album art to be inserted in to an img tag (img src=medium_sized_image_url alt=). I've tried searching but can't find anything, I'm doubly interested because I wouldn't mind using the URL that's in there as well.
[jQuery] Best book to learn jQuery?
Just wondering what your opinions are on the best book out there, for a beginner, to learn jQuery? I know HTML and CSS well enough, but have no javascript knowledge. Thanks
[jQuery] Re: Best book to learn jQuery?
Are there any problems when jQuery is updated, or is it solely no information about new effects and stuff? I've only been using jQuery for a couple of weeks, are new releases frequent? On May 18, 2:35 pm, Karl Swedberg k...@englishrules.com wrote: I've heard Learning jQuery 1.3 is a great read, too. ;-) --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On May 18, 2009, at 9:07 AM, MorningZ wrote: I always recommend jQuery in Action it's a great read On May 18, 3:19 am, alex boba...@googlemail.com wrote: Just wondering what your opinions are on the best book out there, for a beginner, to learn jQuery? I know HTML and CSS well enough, but have no javascript knowledge. Thanks
[jQuery] Re: Best book to learn jQuery?
Ah. I'm sure this sounds dunce-y because 'jQuery does it for me', but is a solid grounding in Javascript necessary to a solid grounding in jQuery (or at least, being able to use jQuery), or just good practice? I would guess, as a complete novice, that just using what is already available may not require pure JS knowledge, but more advanced things like building plugins would? I assume then that 'Learning jQuery' would not be the first port of call for me? On May 18, 2:55 pm, mdk mklosterme...@gmail.com wrote: Yes, but because he has no JS he will like have a tough time. I would read a basic JS book first, then go for Learning jQuery 1.3. Mike On May 18, 8:35 am, Karl Swedberg k...@englishrules.com wrote: I've heard Learning jQuery 1.3 is a great read, too. ;-) --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On May 18, 2009, at 9:07 AM, MorningZ wrote: I always recommend jQuery in Action it's a great read On May 18, 3:19 am, alex boba...@googlemail.com wrote: Just wondering what your opinions are on the best book out there, for a beginner, to learn jQuery? I know HTML and CSS well enough, but have no javascript knowledge. Thanks
[jQuery] JavaScript magician needed
Hi All! I am looking for JavaScript gurus for 4-6 month contract or full-time position. Please send me your resume if you are guru and interested. Best regards Alex
[jQuery] Re: Call for contributors: A simple, fast and flexible grid/spreadsheet component.
I understand the view that Ajax / Lazy-Loading doesn't belong in the grid's code-base but I do think an example showing a basic form of this functionality would be a big help. I know I'd appreciate it.
[jQuery] Recommendation for an autocomplete plugin
Hi, I'm looking for a plugin which should be used to populate dynamically an input element, which holds the recipents of a message (the classic case) I have only two requirements: 1) the plugin should be able to insert an image in the dropdown list (the avatar of each recipient) 2) It should throttle submissions (not mandatory) Do you have a plugin to suggest me? Thank you
[jQuery] Superfish - permanently display drop-down
the superfish dropdown menu is almost perfect for some work i'm doing. however, on some pages i need the dropdown content from the relevant menu item to be on display. i'm competent enough to simply change the hover state in css for a javascript disabled menu to work, but would appreciate some help adapting the full superfish version to do so. is it possible to tweak the code to do this on certain pages? thanks in advance, Alex.
[jQuery] Array function
Gday, Is there a short way to do: $(#idOne).show(); $(#idTwo).show(); ? So far, my best bet is to do: $.each([#idOne,#idTwo],function(){ $(+this).show(); }); Thanks in advance! -- Best regards, WiB
[jQuery] Re: jQuery and Ruby on Rails
www.railscasts.com search : jquery On 2009-4-3, at 下午4:08, bigPHIL18 wrote: Anyone? On Apr 2, 8:24 pm, bigPHIL18 philip.dud...@quinnipiac.edu wrote: Hello all, I have been reading a lot and can not find what I am looking for. I have a Rails project, and have written a script to get the class of a ul. I want to pass this variable gathered from the script and pass it on to Rails. How would i got about doing this? For your information: I wrote this jQuery script just so I could set a variable name to the name when the mouse is clicked on the UL. From then the I can delete the file from the server. Thank you, Phil
[jQuery] I can't open google group in browse
Hi guys, I can't open google group in browse .Can you open it ? thank you Alex
[jQuery] Do you have jQuery MVC plugin ?
Hi guys, Do you have jQuery MVC plugin based on jQuery1.3 ? Thank you! Alex
[jQuery] Re: Do you have jQuery MVC plugin ?
Thank you. On 2009-3-16, at 下午4:44, Schalk Neethling wrote: Hi there Alex, You may want to look into JavaScriptMVC. The author is working on integrating this into jQuery as a plugin. You can also read more about this here: http://www.opensourcereleasefeed.com/interview/show/justin-meyer-javascriptmvc-jquery-enterprise-open-source HTH, Schalk Alex wrote: Hi guys, Do you have jQuery MVC plugin based on jQuery1.3 ? Thank you! Alex volume4_schalk.vcf
[jQuery] Re: Do you have jQuery MVC plugin ?
oh, suck, http://javascriptmvc.com/ the site be blocked in my Country . I find another MVC js lib based on jQuery, Jamal.js (http://jamal-mvc.com/ ) Thanks . On 2009-3-16, at 下午4:44, Schalk Neethling wrote: Hi there Alex, You may want to look into JavaScriptMVC. The author is working on integrating this into jQuery as a plugin. You can also read more about this here: http://www.opensourcereleasefeed.com/interview/show/justin-meyer-javascriptmvc-jquery-enterprise-open-source HTH, Schalk Alex wrote: Hi guys, Do you have jQuery MVC plugin based on jQuery1.3 ? Thank you! Alex volume4_schalk.vcf
[jQuery] Re: Do you have jQuery MVC plugin ?
I use it in offline project with google gears. this is architecture of the project : http://4.bp.blogspot.com/_6lbO8zu9hgg/SbdP-g1gCjI/ACs/-4I6OCs8CZA/s1600-h/Picture+1.png I need mvc framework to organize my js code. On 2009-3-16, at 下午5:09, Joseph Le Brech wrote: I don't get this, isn't javascript supposed to be part of the view layer? maybe at a stretch part of the controller layer. is this something similar to google gears where the model is stored in cookies too? From: blackange...@gmail.com To: jquery-en@googlegroups.com Subject: [jQuery] Re: Do you have jQuery MVC plugin ? Date: Mon, 16 Mar 2009 16:56:27 +0800 oh, suck, http://javascriptmvc.com/ the site be blocked in my Country . I find another MVC js lib based on jQuery, Jamal.js (http://jamal-mvc.com/ ) Thanks . On 2009-3-16, at 下午4:44, Schalk Neethling wrote: Hi there Alex, You may want to look into JavaScriptMVC. The author is working on integrating this into jQuery as a plugin. You can also read more about this here: http://www.opensourcereleasefeed.com/interview/show/justin-meyer-javascriptmvc-jquery-enterprise-open-source HTH, Schalk Alex wrote: Hi guys, Do you have jQuery MVC plugin based on jQuery1.3 ? Thank you! Alex volume4_schalk.vcf Share your photos with Windows Live Photos – Free. Try it Now!
[jQuery] What do you recommend to generate UUID with jQuery ?
Hi all, What do you recommend to generate UUID with jQuery ? Thank you ! Alex
[jQuery] Re: What do you recommend to generate UUID with jQuery ?
thank you very much! On 2009-3-6, at 上午10:48, Mike Alsup wrote: What do you recommend to generate UUID with jQuery ? Thank you ! I've been using something like this: function uid() { var result=''; for(var i=0; i32; i++) result += Math.floor(Math.random()*16).toString(16).toUpperCase (); return result }
[jQuery] tbody:first-child thead
Hi all, I have a code that counts the number of rows in a table... the table looks like: table id=myTable thead ... /thead tbody tr /tr /tbody /table and my jquery looks like: $(#myTable tbody:first-child tr).length; strange enough that always returns 0. but if i remove the thead from the table... then it will return the correct number of rows.. or alternatively, i can keep the thead, but use the following instead: $(#myTable tbody tr).length; i.e. without specifying first-child. Can anyone explain this behaviour? THanks a lot! -- Best regards, WiB
[jQuery] Re: tbody:first-child thead
how does that explain the behaviour when there's thead then?? On Wed, Feb 25, 2009 at 7:47 PM, David Muir davidkm...@gmail.com wrote: It's because tbody:first-child is already selecting the tr, so you're effectively doing: tbody tr tr (where the first tr is the first child of tbody) Cheers, David Alex Wibowo wrote: Hi all, I have a code that counts the number of rows in a table... the table looks like: table id=myTable thead ... /thead tbody tr /tr /tbody /table and my jquery looks like: $(#myTable tbody:first-child tr).length; strange enough that always returns 0. but if i remove the thead from the table... then it will return the correct number of rows.. or alternatively, i can keep the thead, but use the following instead: $(#myTable tbody tr).length; i.e. without specifying first-child. Can anyone explain this behaviour? THanks a lot! -- Best regards, WiB -- Best regards, WiB
[jQuery] Re: tbody:first-child thead
sorry i should say how does that explain the behaviour when there's no thead (because it works when thead doesnt exist) On Wed, Feb 25, 2009 at 8:06 PM, Alex Wibowo alexwib...@gmail.com wrote: how does that explain the behaviour when there's thead then?? On Wed, Feb 25, 2009 at 7:47 PM, David Muir davidkm...@gmail.com wrote: It's because tbody:first-child is already selecting the tr, so you're effectively doing: tbody tr tr (where the first tr is the first child of tbody) Cheers, David Alex Wibowo wrote: Hi all, I have a code that counts the number of rows in a table... the table looks like: table id=myTable thead ... /thead tbody tr /tr /tbody /table and my jquery looks like: $(#myTable tbody:first-child tr).length; strange enough that always returns 0. but if i remove the thead from the table... then it will return the correct number of rows.. or alternatively, i can keep the thead, but use the following instead: $(#myTable tbody tr).length; i.e. without specifying first-child. Can anyone explain this behaviour? THanks a lot! -- Best regards, WiB -- Best regards, WiB -- Best regards, WiB
[jQuery] Re: tbody:first-child thead
Hi Karl.. thanks for the reply... what i actually wanted is to select the first tbody thats why i specified tbody:first-child there since a table can have multiple tbody... i want to select the first tbody. What I didnt understand is about the thead.. the following works table id=myTable tbody tr /tr /tbody /table $(#myTable tbody:first-child tr).length; but this doesnt work: table id=myTable thead tr ... /tr /thead tbody tr /tr /tbody /table $(#myTable tbody:first-child tr).length; I dont know how thead causes the second code above not to work... On Wed, Feb 25, 2009 at 8:11 PM, Karl Rudd karl.r...@gmail.com wrote: tbody:first-child doesn't select the first child of the tbody it says select the tbody that is the 'first-child' of it's parent. So what you are actually wanting to say is: $(#myTable tbody tr:first-child) Which is select the tr that is the first child of tbody http://docs.jquery.com/Selectors/firstChild Karl Rudd On Wed, Feb 25, 2009 at 8:08 PM, Alex Wibowo alexwib...@gmail.com wrote: sorry i should say how does that explain the behaviour when there's no thead (because it works when thead doesnt exist) On Wed, Feb 25, 2009 at 8:06 PM, Alex Wibowo alexwib...@gmail.com wrote: how does that explain the behaviour when there's thead then?? On Wed, Feb 25, 2009 at 7:47 PM, David Muir davidkm...@gmail.com wrote: It's because tbody:first-child is already selecting the tr, so you're effectively doing: tbody tr tr (where the first tr is the first child of tbody) Cheers, David Alex Wibowo wrote: Hi all, I have a code that counts the number of rows in a table... the table looks like: table id=myTable thead ... /thead tbody tr /tr /tbody /table and my jquery looks like: $(#myTable tbody:first-child tr).length; strange enough that always returns 0. but if i remove the thead from the table... then it will return the correct number of rows.. or alternatively, i can keep the thead, but use the following instead: $(#myTable tbody tr).length; i.e. without specifying first-child. Can anyone explain this behaviour? THanks a lot! -- Best regards, WiB -- Best regards, WiB -- Best regards, WiB -- Best regards, WiB
[jQuery] Re: tbody:first-child thead
ahhh ok ... now i get it. sorry for wasting your time, guys... i thought its E F:first-child reads the first child of E of type F... i didn't know that it has to explicitly be the first child. I didnt even know that this syntax is CSS thing i thought it is jQuery's syntax. Thanks for pointing out to that website! Question is:first :eq(n) also a CSS syntax? Thanks again! On Wed, Feb 25, 2009 at 11:29 PM, Mauricio (Maujor) Samy Silva css.mau...@gmail.com wrote: Ops! my faul! sorry. Previous post errata. Read: ...BEFORE the F element ... instead of: ...BEFORE the E element... -Mensagem Original- *De:* Mauricio (Maujor) Samy Silva css.mau...@gmail.com *Para:* jquery-en@googlegroups.com *Enviada em:* quarta-feira, 25 de fevereiro de 2009 09:24 *Assunto:* Re: [jQuery] Re: tbody:first-child thead Hi Alex, 1-) Doesn't work because * E F:first-child * pseudo-class selector matches the F element that is the first child of the E element ONLY if there isn't another element BEFORE the E element within the parent E. See specs at: http://www.w3.org/TR/CSS2/selector.html#first-child 2-) If you have a thead or/and a tbody in your markup, to select the first thead use the pseudo-class :eq instead. $(#myTable tbody:eq(0) tr).length ) Maurício -Mensagem Original- *De:* Alex Wibowo alexwib...@gmail.com *Para:* jquery-en@googlegroups.com *Enviada em:* quarta-feira, 25 de fevereiro de 2009 08:33 *Assunto:* [jQuery] Re: tbody:first-child thead Hi Karl.. thanks for the reply... what i actually wanted is to select the first tbody thats why i specified tbody:first-child there since a table can have multiple tbody... i want to select the first tbody. What I didnt understand is about the thead.. the following works table id=myTable tbody tr /tr /tbody /table $(#myTable tbody:first-child tr).length; but this doesnt work: table id=myTable thead tr ... /tr /thead tbody tr /tr /tbody /table $(#myTable tbody:first-child tr).length; I dont know how thead causes the second code above not to work... On Wed, Feb 25, 2009 at 8:11 PM, Karl Rudd karl.r...@gmail.com wrote: tbody:first-child doesn't select the first child of the tbody it says select the tbody that is the 'first-child' of it's parent. So what you are actually wanting to say is: $(#myTable tbody tr:first-child) Which is select the tr that is the first child of tbody http://docs.jquery.com/Selectors/firstChild Karl Rudd On Wed, Feb 25, 2009 at 8:08 PM, Alex Wibowo alexwib...@gmail.com wrote: sorry i should say how does that explain the behaviour when there's no thead (because it works when thead doesnt exist) On Wed, Feb 25, 2009 at 8:06 PM, Alex Wibowo alexwib...@gmail.com wrote: how does that explain the behaviour when there's thead then?? On Wed, Feb 25, 2009 at 7:47 PM, David Muir davidkm...@gmail.com wrote: It's because tbody:first-child is already selecting the tr, so you're effectively doing: tbody tr tr (where the first tr is the first child of tbody) Cheers, David Alex Wibowo wrote: Hi all, I have a code that counts the number of rows in a table... the table looks like: table id=myTable thead ... /thead tbody tr /tr /tbody /table and my jquery looks like: $(#myTable tbody:first-child tr).length; strange enough that always returns 0. but if i remove the thead from the table... then it will return the correct number of rows.. or alternatively, i can keep the thead, but use the following instead: $(#myTable tbody tr).length; i.e. without specifying first-child. Can anyone explain this behaviour? THanks a lot! -- Best regards, WiB -- Best regards, WiB -- Best regards, WiB -- Best regards, WiB -- Best regards, WiB
[jQuery] Re: tbody:first-child thead
Hi Ricardo Thats great... thx a lot! On Thu, Feb 26, 2009 at 5:06 AM, ricardobeat ricardob...@gmail.com wrote: Tables have native properties which are much faster to access: $('#myTable')[0].rows.length //number of rows $('#myTable')[0].tBodies[0].rows.length //number of rows in the first tbody cheers, - ricardo On Feb 25, 5:25 am, Alex Wibowo alexwib...@gmail.com wrote: Hi all, I have a code that counts the number of rows in a table... the table looks like: table id=myTable thead ... /thead tbody tr /tr /tbody /table and my jquery looks like: $(#myTable tbody:first-child tr).length; strange enough that always returns 0. but if i remove the thead from the table... then it will return the correct number of rows.. or alternatively, i can keep the thead, but use the following instead: $(#myTable tbody tr).length; i.e. without specifying first-child. Can anyone explain this behaviour? THanks a lot! -- Best regards, WiB -- Best regards, WiB
[jQuery] whether the structure of the jQuery object like this
whether the structure of the jQuery object like this : $('p') if the tag p only one, the structure is : [ [attr = value ]] if the tag p has two , the structure is : [ [ attr = value], [attr = value] ] Thanks Alex
[jQuery] Re: How can I specify what $(this) is within a function?
$(this) is no problem. hover_in() and hover_out() should place in each method. if hover_in() and hover_out() placed outside each method, $this in hover_in() and hover_out() is all li tag. are u understand ? you should write like this : = $.fn.simpleFunction = function(options) { var options = jQuery.extend( {colorOne:'#660066', colorTwo:'#808080'},options); this.each(function() { var $this = $(this); function hover_in() {$this.css({backgroundColor:options.colorOne});}; function hover_out() {$this.css({backgroundColor:options.colorTwo});}; $(this).hover(function () { hover_in(); },function(){ hover_out(); }); }); return this; }; $(.hover_me).simpleFunction(); }); === On 2009-2-22, at 上午3:06, Nikola wrote: Hello, I've written a simple function for a hover event but I can't seem to specify what $(this) is properly. Here's a little example I put together, any input would be great. Thanks.. http://jsbin.com/ezeye/edit
[jQuery] JavaScript not executing from external html files from Ajax call into Div
Hello, This is my first message and I am extremely new to jQuery. I am using Ajax to call external html pages into a div in my site. I have three external html forms which uses JavaScript and one .pl file. When I call these pages, the html pages are being rendered correctly but the JavaScript and .pl file (form post) is not being executed. Any ideas on how to resolve? Any assistance/help would be appreciated. Thanks in advance. - Alex
[jQuery] Re: Large images IE ready event
Thanks. Hopefully it will be fixed soon. On Jan 31, 2:32 pm, Karl Swedberg k...@englishrules.com wrote: Hi Alex, Which version of jQuery are you using? If it's 1.3.1, there was a regression that caused this problem. This has been fixed in the svn version. See the bug report here: http://dev.jquery.com/ticket/3988 --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Jan 30, 2009, at 10:19 AM, Alex wrote: In IE 6 through 8, whenever I use $(document).ready(function(){ });, it doesn't get triggered if there are still images trying to load. I use a graphic engine to draw huge graphs and it can take up to 5 seconds parsing the images and the code between the ready event doesnt get triggered until the images are fully loaded. It works flawlessly in Firefox. Only IE6-8 has this problem. Is there something I am missing in my code? Is this a known issue with IE? Thanks.
[jQuery] Large images IE ready event
In IE 6 through 8, whenever I use $(document).ready(function(){ });, it doesn't get triggered if there are still images trying to load. I use a graphic engine to draw huge graphs and it can take up to 5 seconds parsing the images and the code between the ready event doesnt get triggered until the images are fully loaded. It works flawlessly in Firefox. Only IE6-8 has this problem. Is there something I am missing in my code? Is this a known issue with IE? Thanks.
[jQuery] Re: live Problem
cool, just what i need . On 2009-1-30, at 上午10:47, Brandon Aaron wrote: Stick with Live Query but grab the latest version of Live Query from GitHub: http://github.com/brandonaaron/livequery/tree/master -- Brandon Aaron On Thu, Jan 29, 2009 at 7:59 PM, Pedram pedram...@gmail.com wrote: Dear FOlk , I'm going to upgrade my liveQuery code , I figured out that LIVE in jQuery 1.3.1 doesn't Support Focus and Blur and also it doesn't support the no-event Style callback that liveQuery provides... what is the solution.
[jQuery] how to use onfocus event with jQuery ?
hi all, i'm new to jQuery,how to use onfocus event with jQuery ? Could you give me a demo ? Thank you! Alex
[jQuery] Re: how to use onfocus event with jQuery ?
thank you! i need to bind focus event to new elem after page loaded, how to do it ? jQuery1.3 live() not support focus and blur event . On 2009-1-29, at 上午11:03, jay wrote: http://docs.jquery.com/Events/focus On Jan 28, 9:28 pm, Alex blackange...@gmail.com wrote: hi all, i'm new to jQuery,how to use onfocus event with jQuery ? Could you give me a demo ? Thank you! Alex
[jQuery] Re: Happy 牛 Year !
谢谢! On 2009-1-25, at 下午12:40, system div wrote: Today is Chinese New Year . Happy 牛 Year !
[jQuery] Callback problem
Hello! i have a code var handler = editElementName; function showModalBox(width, height, handler, id) { ... $(.btnSave).click(handler + Save); ... } function editElementNameSave(e) { alert(1); } Why dont work event click? PS sorry for my English - i am from Russia
[jQuery] how to use namespace and Class in jQuery ?
Hi all, I ' m new to jQuery. How to use namespace and Class , like this: cm.TestClass = function { } cm is namespace. Alex
[jQuery] Re: Submitting a form with .submit() problems
If I undestood the task right, you can create code in such way. You form will be like this: tabletr form action=http://jquery.com; method=post id=myForm td input value=submit type=submit onclick=conversion(1000, this); / /td /form /tr /table Convertion(1000, this) will return: true, if it`s neccesary to submit form. false, in other case. For this question: 'Is there another way to get to the form tag by traversing elements in reverse order? '.. But parents('form') returns reverse order...
[jQuery] Re: Anyway to highlight words accents-insensitive?
Just for the record, there's another bug with IE when you search for a pattern (let's say e) in a sentence containing two or more occurences of this pattern together (for example: Feel). This is due to a strange way (I call it a bug) that IE has to deal with the split () method. I suggest that the following is included somewhere in your code for the fix: http://blog.stevenlevithan.com/archives/cross-browser-split
[jQuery] Re: Anyway to highlight words accents-insensitive?
So, I tried something similar to what I had in mind and was able to get it working. I'll put it here in case anyone wants it: # ORIGINAL CODE # highlight: function(value, term) { return value.replace(new RegExp((?![^;]+;)(?![^]*)( + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, \\$1) + )(?![^] *)(?![^;]+;), gi), strong$1/strong); } # MODIFIED CODE WITH ACCENTS-INSENSITIVE SUPPORT # highlight : function(value, term) { // Strip accents from 'term' for an accents-insensitive search term = stripAccents(term); var value_no_accents = stripAccents(value); var everything_except_term = value_no_accents.split(new RegExp(term, gi)); var highlighted_value = ''; var current_position = 0; for (var n in everything_except_term) { // Get the part with accents, since they were stripped to make the comparisson using RegExp, and add it to the final value var part_no_accents = everything_except_term[n]; var part = value.substr(current_position, part_no_accents.length); //--- this one with accents!!! highlighted_value += part; // Add the part length to the current position current_position += part.length; // If its not the last part, add the accented and highlighted term to the final value if (n everything_except_term.length - 1) { // Get the term with the original accentuation and add it highlighted to the final value var termo_local = value.substr(current_position, term.length); highlighted_value += strong + termo_local + /strong; // Update the current position current_position += term.length; } } return highlighted_value; } Where the function to strip accents (Credits: http://scripterlative.com/?noaccent) is: function stripAccents(str) { var rExps=[ {re:/[\xC0-\xC6]/g, ch:'A'}, {re:/[\xE0-\xE6]/g, ch:'a'}, {re:/[\xC8-\xCB]/g, ch:'E'}, {re:/[\xE8-\xEB]/g, ch:'e'}, {re:/[\xCC-\xCF]/g, ch:'I'}, {re:/[\xEC-\xEF]/g, ch:'i'}, {re:/[\xD2-\xD6]/g, ch:'O'}, {re:/[\xF2-\xF6]/g, ch:'o'}, {re:/[\xD9-\xDC]/g, ch:'U'}, {re:/[\xF9-\xFC]/g, ch:'u'}, {re:/[\xD1]/g, ch:'N'}, {re:/[\xF1]/g, ch:'n'} ]; for(var i=0, len=rExps.length; ilen; i++) str=str.replace(rExps[i].re, rExps[i].ch); return str; } I'll send and e-mail to the plugin creator suggesting the inclusion of an ignoreAccents option, which would toggle beetwen the original and the modified code. That's it. Thanks again for the help!
[jQuery] Re: Anyway to highlight words accents-insensitive?
There is a bug in the previous code with Internet Explorer. To fix it, replace this: ### // If its not the last part, add the accented and highlighted term to the final value if (n everything_except_term.length - 1) { // Get the term with the original accentuation and add it highlighted to the final value var termo_local = value.substr(current_position, term.length); highlighted_value += strong + termo_local + /strong; // Update the current position current_position += term.length; } ### With this: ### // Get the term with the original accentuation and add it highlighted to the final value var term_local = value.substr(current_position, term.length); highlighted_value += (term_local == '') ? term_local : strong + term_local + /strong; // Update the current position current_position += term.length; ### Not as straightforward as the other, but now works in Firefox 3, Opera 9 and Internet Explorer 6 and 7. (I also corrected a typo from the translation: termo_local is actually term_local). Also, Jörn (the plugin creator) alerted me that it's not necessary to change the plugin source code because 'highlight' is an option that can be overwritten globally or locally. So people interested in this modification won't have much trouble implementing it.
[jQuery] Joomla and jqGalScroll
Hi there, i am not sure if i am writing to the right place:) Installed jquery into the joomla, posted, works great Only one thing it's shows the bullets beside every image, and between pagination numbers It works fine on regular html page... Please help?? Best Regards, Alex 778.991.3593 design: www.acreative.ca art: www.ozipov.com
[jQuery] Use mouseover when use a Draggable()
Hi, I want use a mouseover and mouseout event when I Drag some object, but when I use drag in some object the mouse events in other object dont start. Exemple I have a table and its cells have a mouseover and mouseout to change your background. When I move the mouse curso on the cell mouseover and mouseout start, but if I drag some object this events cant start. Tks I use this JS $('#drag1').Draggable({snapDistance: 10}); $(#td01).mouseover(function(){ this.style.backgroundColor = '#cc'; }); $(#td01).mouseout(function(){ this.style.backgroundColor = '#ff'; }); and this HTML div id=drag1 class=draggable a href=index.phpDrag me/a /divbrbr table border=1 width=50% tr td id=td01nbsp;/td tdnbsp;/td tdnbsp;/td /tr /table
[jQuery] [autocomplete] Anyway to highlight words accents-insensitive?
Autocomplete plugin: http://docs.jquery.com/Plugins/Autocomplete As in the subject, I want to be able to highlight the words accents- insensitivily. Example: if I type Jose, José would be highlighted and vice-versa (José would highlight Jose). Is there anyway to do it? I'm willing to make changes in the source code, if it's necessary.
[jQuery] validating form with server-side code via ajax (progressive enhancement)
Just bumping in hopes of any fresh ideas on this.
[jQuery] looking for hijax validation (with graceful degradation)
I'm looking for a way to validate various forms which each require different information, but discrete chunks of information could be easily validated by simple rules (e.g. checks for valid email address, url, zip code, telephone, etc…) In the past, it was satisfactory to make self-submitting PHP pages that include some validation code, and if errors were found, the form would be redisplayed (with data intact), errors displayed, invalid fields highlighted with a CSS error class, etc… I was using a small PHP include to validate the most common data, and any corner-case rules, I'd write into the page itself. As a finishing touch, I'd add jquery validation (I've used about 3 or 4 different validation plugins), writing matching rules. Now I'm getting more requests for forms, and this duplication of rules is getting absurd. I don't think that what I'm looking for is magic; it seems like I can see all the pieces scattered about, but my own efforts to do this as a novice are stumbling and excruciating.I've been searching the web and the newsgroups with dozens of different combinations of terms hoping to find a solution that will work the way I'd really like it to. JS disabled - user fills out form, clicks submit - form is submitted to server-side PHP script - script switches to PHP-friendly output since the submission doesn't appear to be via ajax* - script uses hidden form values (placed inside a noscript tag on the form) to determine required or conditional fields - if there's no errors, script passes the data on to a success handler (cgi form, generated email, etc…) and displays a success message - if there are errors, the original data is returned to the form along with an error array - form redisplays, with entries intact and error messages displayed, invalid inputs highlighted with a css class, etc… JS enabled - user enters data, changed fields - jQuery submits the input to the server-side PHP script, along with any specific rules it should be validated through (required, numeric, email, etc…) - script switches to json or other jQuery-friendly output since the submission was made via ajax* - if there's no error, script returns success back via ajax, and jQuery runs the associated success action (add a success icon, show/ enable dependent fields, allow full submission (which would effectively be the noscript version listed above), etc…) - if there's an error, script returns error message, and jQuery runs the associated success action (display returned error, add error class, send user to 4chan, etc…) * I've seen this used to switch/case the server-side of things: return ((!empty($_SERVER['HTTP_X_REQUESTED_WITH'])) $_SERVER ['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'); As far as which error is displayed when there are multiple conditions, a general progression of severity seems reasonable - i.e. required must be x noncritical (what, your name has no capital letters?) optional I found these sibling scripts (whose rules are effectively interchangable), but rulesets are *still* defined twice, once server- side, and once in the javascript: http://www.benjaminkeen.com/software/php_validation/ http://www.benjaminkeen.com/software/rsv/jquery/ I also stumbled into this, but I can't find much info on it (probably dead/stalled - anyone know?); I think it might work out if I can figure out how to make a mashup with the server-side version of the above: http://deadguy.reliccommunity.com/stuffbox/js/jquery-jvalidate.js Jörn's plugin seems to prefer its internal methods for the usual suspects, reserving remote() for the more esoteric validation conditions (I know extensions are in the works). I'm just boggled that I can't seem to find validation-lite.js or something; server-side validation that only gets sweeter when a dab of jQuery gives it that jewel-like shine. Anyway, I'm still a million miles away from reaching even novice in either js or php, and could really use some good advice/solutions.
[jQuery] Using window.location.hash for URLs without plugin
Hi, I'm trying to use URL's such as 'mysite.com/#contact' that will show a certain div. I have my function written and working to show the div, currently being used as $(#a.contact).click(showContact); How would I use something like window.location.hash to fire off the function showContact for example, if the URL was /#contact? This would need to provide for about 3 pages, Home, About, Portfolio and Contact. I know there's a plugin for enabling use of the back button etc, but I'd rather something simple without having to load plugins. Many thanks, Alex
[jQuery] Re: Using window.location.hash for URLs without plugin
Thanks, I ended up using a switch: var page = location.hash; switch(page) { case #networks: showPlaces(); break; case #about: showAbout(); break; case #contact: showContact(); break; default: showPlaces(); } Works great for me. Thanks again, Alex -- Alex On Fri, Dec 5, 2008 at 5:57 PM, Andy Matthews [EMAIL PROTECTED]wrote: location.hash is a property, so you'd just get it's value then compare that. Something like this might work: // get the hash var page = location.hash; // show the correct page $('#' + page).show(); andy matthews -- *From:* jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Alex Hempton-Smith *Sent:* Friday, December 05, 2008 11:48 AM *To:* jquery-en@googlegroups.com *Subject:* [jQuery] Using window.location.hash for URLs without plugin Hi, I'm trying to use URL's such as 'mysite.com/#contact' that will show a certain div. I have my function written and working to show the div, currently being used as $(#a.contact).click(showContact); How would I use something like window.location.hash to fire off the function showContact for example, if the URL was /#contact? This would need to provide for about 3 pages, Home, About, Portfolio and Contact. I know there's a plugin for enabling use of the back button etc, but I'd rather something simple without having to load plugins. Many thanks, Alex