[jQuery] Re: Select all controls of the form
I want to convert some existing code from traditional javascript for loop to $.each. Here is my code: var oEl = document.getElementById(my_form_id).elements; for(var i=0; i oEl.length; i++) { //do something } In jquery I have written a $.fn.extend function and the code as: $.fn.extend({ test: function() { //I want to filter only input controls from hte form var $this = $(this).filter(:input); $.each($this, function() { //do something }); } }) $(#my_form_id).test(); But it is not working. On Jan 13, 12:05 pm, Karl Rudd karl.r...@gmail.com wrote: Errr img elements aren't form controls. input type=image elements are but :input selects those. I'm not sure what you mean. Karl Rudd On Tue, Jan 13, 2009 at 5:43 PM, JQueryProgrammer jain.ashis...@gmail.com wrote: The above code selects all the controls except img tag. On Jan 13, 11:26 am, Karl Rudd karl.r...@gmail.com wrote: The '*' selector will select _all_ the nodes (including the br/s). Try using the ':input' selector: $(#form1 :input) http://docs.jquery.com/Selectors Karl Rudd On Tue, Jan 13, 2009 at 5:16 PM, JQueryProgrammer jain.ashis...@gmail.com wrote: I am trying to validate all the controls that exist in the form. My form code looks like: form id=form1 input type=text id=txt1 name=txt1 / br/ textarea name=txtArea id=txtArea cols=100 rows=4 / br/ select id=sel1 name=sel1 style=width: 250px; option value=Select/option option value=1One/option option value=2Two/option option value=3Three/option /select br/ input type=radio id=rdo1 name=rdo1 value=Option1nbsp;Option 1nbsp; br/ input type=radio id=rdo2 name=rdo1 value=Option2nbsp;Option 2nbsp; br/ button id=btn1Submit/button button id=btn2Reset/button /form I want to select only the controls of the form viz: textbox, textarea, select, radio button (Total 7). I am trying to extract them as $(#form1 *).each(function() { alert($(#+this).attr(id)); }) it gives me total 16 alerts. I want just 7. Any help..?
[jQuery] Re: Select all controls of the form
You shouldn't need to use $.extend in this case. Something like this should work: jQuery.fn.debug = function() { return this.each(function(){ alert(this); }); }; Taken from http://docs.jquery.com/Plugins/Authoring As for your selection code, you need to use find instead of filter. The filter removes non-matching elements, if you pass in a form element then it won't do what you want. The find function works on the child elements of the given elements, which is what you want. Karl Rudd On Tue, Jan 13, 2009 at 7:17 PM, JQueryProgrammer jain.ashis...@gmail.com wrote: I want to convert some existing code from traditional javascript for loop to $.each. Here is my code: var oEl = document.getElementById(my_form_id).elements; for(var i=0; i oEl.length; i++) { //do something } In jquery I have written a $.fn.extend function and the code as: $.fn.extend({ test: function() { //I want to filter only input controls from hte form var $this = $(this).filter(:input); $.each($this, function() { //do something }); } }) $(#my_form_id).test(); But it is not working. On Jan 13, 12:05 pm, Karl Rudd karl.r...@gmail.com wrote: Errr img elements aren't form controls. input type=image elements are but :input selects those. I'm not sure what you mean. Karl Rudd On Tue, Jan 13, 2009 at 5:43 PM, JQueryProgrammer jain.ashis...@gmail.com wrote: The above code selects all the controls except img tag. On Jan 13, 11:26 am, Karl Rudd karl.r...@gmail.com wrote: The '*' selector will select _all_ the nodes (including the br/s). Try using the ':input' selector: $(#form1 :input) http://docs.jquery.com/Selectors Karl Rudd On Tue, Jan 13, 2009 at 5:16 PM, JQueryProgrammer jain.ashis...@gmail.com wrote: I am trying to validate all the controls that exist in the form. My form code looks like: form id=form1 input type=text id=txt1 name=txt1 / br/ textarea name=txtArea id=txtArea cols=100 rows=4 / br/ select id=sel1 name=sel1 style=width: 250px; option value=Select/option option value=1One/option option value=2Two/option option value=3Three/option /select br/ input type=radio id=rdo1 name=rdo1 value=Option1nbsp;Option 1nbsp; br/ input type=radio id=rdo2 name=rdo1 value=Option2nbsp;Option 2nbsp; br/ button id=btn1Submit/button button id=btn2Reset/button /form I want to select only the controls of the form viz: textbox, textarea, select, radio button (Total 7). I am trying to extract them as $(#form1 *).each(function() { alert($(#+this).attr(id)); }) it gives me total 16 alerts. I want just 7. Any help..?
[jQuery] Re: Once validated..
You can check a var in jQuery using the following method: ?php $my_php_var = Value; ? script ... var my_js_var = ?php echo $my_php_var; ?; if (my_js_var == Value) { alert(Value set); } /script Thats one of the Q's down! M On Jan 13, 3:45 am, Nikola nik.cod...@gmail.com wrote: I'm validating a form in php and am wondering how I can bind a jQuery function to a successful validation or how to check a var set in php with jQuery.
[jQuery] Re: anyone knows vertical carousel ?
Hi Brian and MorningZ, There is nothing problem with first example.. I just wanted to see different examples.. Thank you about that.. and thank you Karl, This is exactly what I am looking for.. I haven't tried yet, I will try it..
[jQuery] Re: Meta Data within elements
BUMP alexquery wrote: I am creating a product/category tree using jquery. I would like to be able to store additional data within each node. The nodes in my tree are basicaly list elements. How would I add data to these elements such as the count of products and categories beneath them ? I tried this method. jQuery.data(objNode, 'intProdCounter', intProdCounter); But I have had some problems.. are there any other ways of acheiving this ? thanks for any help in advance -- View this message in context: http://www.nabble.com/Meta-Data-within-elements-tp21416642s27240p21431844.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Meta Data within elements
You could try the jQuery metadata plugin if you need the metadata to be in the markup itself. If you don't then using data is probably a better approach. On Jan 12, 3:46 pm, alexquery alext...@gmail.com wrote: I am creating a product/category tree using jquery. I would like to be able to store additional data within each node. The nodes in my tree are basicaly list elements. How would I add data to these elements such as the count of products and categories beneath them ? I tried this method. jQuery.data(objNode, 'intProdCounter', intProdCounter); But I have had some problems.. are there any other ways of acheiving this ? thanks for any help in advance -- View this message in context:http://www.nabble.com/Meta-Data-within-elements-tp21416642s27240p2141... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] To check if an element value is of a particular class type
Hello All This is what I am trying to do. I have defined an email suffix class for a particular textbox element so that it accepts values for that particular class. Whenever there is a different value inserted, it displays a jquery error. Now, there also is an Add button which should add the value and display it in a widget list if it is a valid value. So, I need to check and insert an if else block on the click event of the add button to check if the value inserted in the textbox is a valid email suffix type. How do I check that something like if ($(#element_id).val.className == emailSuffix) { ... } else { ... }
[jQuery] Re: load script regarding to value of textfield
ides anyone? On 12 Jan., 17:43, dirk w dirkwendl...@googlemail.com wrote: thanks a lot for your help! is it possible to additionally explain me how i can execute this link through the ajax functions? that would be great! thanks in advance On 12 Jan., 15:53, jQuery Lover ilovejqu...@gmail.com wrote: Try this: $('#searchButton').click(function(){ var url = 'script type=text/javascript src=http://gdata.youtube.com/feeds/api/videos?q='+ $('#searchText').val() + 'alt=json-in-scriptcallback=showMyVideosmax-results=7format=5/script'; // ajax functions to call $.ajax, $.load, $.get, $.post }); - Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Mon, Jan 12, 2009 at 1:49 PM, dirk w dirkwendl...@googlemail.com wrote: hello community, i have some kind of a beginner question and i really would appreciate if you could help me with that. when someone types a value into the textfield and clicks on search or enter than the javascript line should be called regarding to the entered value. this should happen without reloading the complete page. # FORM form id=searchForm action= input type=text name=searchText id=searchText value= size=30 maxlength=30/ input type=button name=searchButton id=searchButton class=button buttonText value=Search / /form # Script to call script type=text/javascript src=http://gdata.youtube.com/feeds/api/ videos?q=' + searchTerm + 'alt=json-in- scriptcallback=showMyVideosmax-results=7format=5/script see the SearchTerm in the js line, it should be replaced with the value of the textfield. thank you very much in advance! dirk
[jQuery] Re: Can I get the contents from respose by ajax
it's work, thanks On 1月12日, 下午5時03分, Balazs Endresz balazs.endr...@gmail.com wrote: Use filter with $.ajax: $('#response').html($(res).filter('#a').text()); On Jan 12, 9:30 am, David .Wu chan1...@gmail.com wrote: And I found the load is not work either, because it still get the construct not the value for example div id=test/div $(document).ready(function) { $('#test').load('ajax.php #a'); }); and the result was div id=testdiv id=a123/div/div, what I exactly want is div id=test123/div On 1月11日, 下午8時13分, Balazs Endresz balazs.endr...@gmail.com wrote: As jQuery parses this html the output will contain three elements: title, meta, and the div instead of the single html. So .find() won't work because it will search in the descendant elements, but filter will return '#a' because it's an element of the current jQuery object. $('html/html') doesn't work either, I guess it's not possible to create an html element so easily. You can also try setting the dataType option to html (or maybe xml). On Jan 11, 11:13 am, David .Wu chan1...@gmail.com wrote: I tried all your suggestion, but got some weired result. ajax.html !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleajax/title script type=text/javascript src=js/jquery-1.2.6.js/script /head body div id=response/div input name=btn type=button value=ajax id=btn / script language=javascript !-- $(document).ready(function() { $('#btn').click(function() { $.ajax( { url:'ajax.php', cache:false, success:function(res) { $('#response').html($('#a',res).text()); //got nothing $('#response').html($(res + ' #a').text()); //got ajaxtest contents $('#response').html($(res).find('#a').text()); //got nothing } }); }); }); //-- /script /body /html ajax.php !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleajax/title /head body div id=atest contents/div /body /html On 1月10日, 上午2時11分, dropcube ronnyh...@gmail.com wrote: is there any way to get the value 123 straight from div? yes, just apply a jQuery selector to the response content and get whatever you need. In this example: $('#a', res).text(); OR $(res).find('#a').text(); You can also try with $.load that allows you to specify a jQuery selector in the URL.
[jQuery] Re: Can I get the contents from respose by ajax
nope, it's doesn't work, I type the wrong character but something interesting happened $('#response').html($(res).filter('#a').text()); - it's not work $('#response').html($(res).filter('$a').text()); - it's give me 123, but not truly work, $('#response').html($(res).text()); - it's not work the same meaning like above, it response text part from responseText On 1月12日, 下午5時03分, Balazs Endresz balazs.endr...@gmail.com wrote: Use filter with $.ajax: $('#response').html($(res).filter('#a').text()); On Jan 12, 9:30 am, David .Wu chan1...@gmail.com wrote: And I found the load is not work either, because it still get the construct not the value for example div id=test/div $(document).ready(function) { $('#test').load('ajax.php #a'); }); and the result was div id=testdiv id=a123/div/div, what I exactly want is div id=test123/div On 1月11日, 下午8時13分, Balazs Endresz balazs.endr...@gmail.com wrote: As jQuery parses this html the output will contain three elements: title, meta, and the div instead of the single html. So .find() won't work because it will search in the descendant elements, but filter will return '#a' because it's an element of the current jQuery object. $('html/html') doesn't work either, I guess it's not possible to create an html element so easily. You can also try setting the dataType option to html (or maybe xml). On Jan 11, 11:13 am, David .Wu chan1...@gmail.com wrote: I tried all your suggestion, but got some weired result. ajax.html !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleajax/title script type=text/javascript src=js/jquery-1.2.6.js/script /head body div id=response/div input name=btn type=button value=ajax id=btn / script language=javascript !-- $(document).ready(function() { $('#btn').click(function() { $.ajax( { url:'ajax.php', cache:false, success:function(res) { $('#response').html($('#a',res).text()); //got nothing $('#response').html($(res + ' #a').text()); //got ajaxtest contents $('#response').html($(res).find('#a').text()); //got nothing } }); }); }); //-- /script /body /html ajax.php !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleajax/title /head body div id=atest contents/div /body /html On 1月10日, 上午2時11分, dropcube ronnyh...@gmail.com wrote: is there any way to get the value 123 straight from div? yes, just apply a jQuery selector to the response content and get whatever you need. In this example: $('#a', res).text(); OR $(res).find('#a').text(); You can also try with $.load that allows you to specify a jQuery selector in the URL.
[jQuery] jQuery scripts not working with php ext.
Hello, On the site I am working on (http://www.pjhconstruction.net/) I have a couple scripts that I am using. Anyways at the moment I am using an shtml extension and using ssi's. I need to be able to convert the site to be using PHP and use php includes. My problem lies with all of my jQuery scripts not functioning anymore. If you go to http://www.pjhconstruction.net/index.shtml, you'll see the image rotator and the collapsed div navigation all working. But, if you go to http://www.pjhconstruction.net/index.php, it's a whole 'nother story. The image rotator is not functioning (and replaced with black div), and if you click the navigation links you will get nothing! I am just wondering, what is happening. It is not my server either, I have tested on two different servers. Maybe there is error in my html or something. I'm just really confused. Thanks, Mike
[jQuery] Validate
I am using jquery ajax to call asp.net page method. How can I use jquery validation for such case when there is no form submission. Here's the code portion used to call page method. $.ajax({ type: POST, url: pagePath + / + fn, contentType: application/json; charset=utf-8, data: paramList, dataType: json, success: successFn, error: errorFn })
[jQuery] Jeditable submitting to function question
Hi there, Let me first say Jeditable is a great plugin! I'm currently trying to get it to submit to a function so I can make the Ajax request return a JSON object and do some things with it before returning the final value. I'm not quite sure how I go about performing an Ajax request inside the function because once the Ajax request has been made it just continues on. I can't seem to figure out a way to get the function to wait for the Ajax function to return and then in the callback somehow pass the value to the original function that Jeditable is expecting the return value from. Take the following code for example: $('.editable').editable(function(value, settings) { $.post(example.php, { id: example, value: value }, function(data){ var valueFromAjaxRequest = data.example; }); //The function should somehow wait for the return value from the Ajax request. return(valueFromAjaxRequest); }, { submit : 'OK', }); I know that Ajax is Asynchronous and shouldn't make the function wait till the callback is made but the documentation on the Jeditable website makes it sound like its possible to do something like this. If anyone knows what I'm talking about and knows how to implement this please let me know. Regards, Rhys
[jQuery] IE Problem with (function($)
I have a problem with Internet Explorer ( all versions ) . The following is my JQuery Code , which executes perfectly in mozilla and chrome.. But it doesn't work in Internet Explorer. It says : Syntax error ( line 1 )... Can anyone help me out here.. Thanks for your time in reading this. (function($){ var EYE = window.EYE = function() { var _registered = { init: [] }; return { init: function() { $.each(_registered.init, function(nr, fn){ fn.call(); }); }, extend: function(prop) { for (var i in prop) { if (prop[i] != undefined) { this[i] = prop[i]; } } }, register: function(fn, type) { if (!_registered[type]) { _registered[type] = []; } _registered[type].push(fn); } }; }(); $(EYE.init); })(jQuery);
[jQuery] Javascript performance testing? In need of some help...
Hello: We have an ajax/js-heavy website that relies on Jquery. Some of the events throughout the site seem to get sluggish as the objects on the page grow. Is anyone interested in a consultative gig to look through our site and point to ways to improve our Jquery implementation, etc? You can decide if an hourly rate or project fee is most applicable once we discuss more - we'll happily pay a competitive rate. Please send over any sites you've worked on, or what your qualifications are. Thanks. Websiteguy websiteguy2...@gmail.com
[jQuery] Re: Meta Data within elements
*http://tinyurl.com/99oc99* On Mon, Jan 12, 2009 at 8:46 PM, alexquery alext...@gmail.com wrote: I am creating a product/category tree using jquery. I would like to be able to store additional data within each node. The nodes in my tree are basicaly list elements. How would I add data to these elements such as the count of products and categories beneath them ? I tried this method. jQuery.data(objNode, 'intProdCounter', intProdCounter); But I have had some problems.. are there any other ways of acheiving this ? thanks for any help in advance -- View this message in context: http://www.nabble.com/Meta-Data-within-elements-tp21416642s27240p21416642.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] load results in new page with .post on success instead of a div
Hi, I'm using jquery with CodeIgniter. I’m currently trying to use jquery’s ajax post to send a couple of variables to a controller and then load that controller according to the variables. This is because other than using the URI to ‘send’ variables, this is the only other way I know, and in this case, I don’t want the URI to have additional segments behind it for the resulting controller. The problem with my ajax post request is that while it is requesting for the controller, it is not displaying the view page that loads from the controller unlike Prototype's ajax.updater .. Can someone help me fix this to obtain the same functionality please? $.post(base_url+/music/test/, { ID: $id, cat: $cat }); so here’s the deal, 1 - I want to load a view with extra variables via a a link, so no forms must be used… 2 - I don’t want to append any uri segments behind that view uri to send the variables 3 - I am NOT trying to load the view in a div, because the php output will print out html for a complete page. I realize the solution is probably far simpler than I’m trying to complicate it, but days of developing other code has somewhat caused my brain to run in circles.. -_- Thank you for your help, truly.
[jQuery] Re: To check if an element value is of a particular class type
http://tinyurl.com/99oc99 http://tinyurl.com/9kmtvp http://tinyurl.com/7nw2mz http://tinyurl.com/7yebhu On Tue, Jan 13, 2009 at 2:39 PM, Santo pujari.sant...@gmail.com wrote: Hello All This is what I am trying to do. I have defined an email suffix class for a particular textbox element so that it accepts values for that particular class. Whenever there is a different value inserted, it displays a jquery error. Now, there also is an Add button which should add the value and display it in a widget list if it is a valid value. So, I need to check and insert an if else block on the click event of the add button to check if the value inserted in the textbox is a valid email suffix type. How do I check that something like if ($(#element_id).val.className == emailSuffix) { ... } else { ... }
[jQuery] Re: Can I get the contents from respose by ajax
never mind, it's really work now, filter is great, thanks. On 1月13日, 下午7時19分, David .Wu chan1...@gmail.com wrote: nope, it's doesn't work, I type the wrong character but something interesting happened $('#response').html($(res).filter('#a').text()); - it's not work $('#response').html($(res).filter('$a').text()); - it's give me 123, but not truly work, $('#response').html($(res).text()); - it's not work the same meaning like above, it response text part from responseText On 1月12日, 下午5時03分, Balazs Endresz balazs.endr...@gmail.com wrote: Use filter with $.ajax: $('#response').html($(res).filter('#a').text()); On Jan 12, 9:30 am, David .Wu chan1...@gmail.com wrote: And I found the load is not work either, because it still get the construct not the value for example div id=test/div $(document).ready(function) { $('#test').load('ajax.php #a'); }); and the result was div id=testdiv id=a123/div/div, what I exactly want is div id=test123/div On 1月11日, 下午8時13分, Balazs Endresz balazs.endr...@gmail.com wrote: As jQuery parses this html the output will contain three elements: title, meta, and the div instead of the single html. So .find() won't work because it will search in the descendant elements, but filter will return '#a' because it's an element of the current jQuery object. $('html/html') doesn't work either, I guess it's not possible to create an html element so easily. You can also try setting the dataType option to html (or maybe xml). On Jan 11, 11:13 am, David .Wu chan1...@gmail.com wrote: I tried all your suggestion, but got some weired result. ajax.html !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleajax/title script type=text/javascript src=js/jquery-1.2.6.js/script /head body div id=response/div input name=btn type=button value=ajax id=btn / script language=javascript !-- $(document).ready(function() { $('#btn').click(function() { $.ajax( { url:'ajax.php', cache:false, success:function(res) { $('#response').html($('#a',res).text()); //got nothing $('#response').html($(res + ' #a').text()); //got ajaxtest contents $('#response').html($(res).find('#a').text()); //got nothing } }); }); }); //-- /script /body /html ajax.php !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleajax/title /head body div id=atest contents/div /body /html On 1月10日, 上午2時11分, dropcube ronnyh...@gmail.com wrote: is there any way to get the value 123 straight from div? yes, just apply a jQuery selector to the response content and get whatever you need. In this example: $('#a', res).text(); OR $(res).find('#a').text(); You can also try with $.load that allows you to specify a jQuery selector in the URL.
[jQuery] Re: Smooth animation
It's hard to tell anything else than I've just said based on this information. If you use .animate() with each coordinates you get then you have to set the duration to a smaller number as jQuery queues up sequential animations by default, so the new one is only executed if the previous one is finished. This makes the animation smoother but it will react slower to sudden changes in the movement depending on the duration. You can also stop the current animation as you get new coordinates and start an other one based on them. For smooth movements animating is also necessary even if you update the position on every mousemove event (see the discussion I mentioned). But using purely the server for smooth animations ... I don't really now how fast web sockets are (network connection and CPU time used) but it sounds a bit hard to carry out -- at least for me :) On Jan 12, 11:11 pm, meneldor menel...@gmail.com wrote: I compute where to move my object server side for better control. I use thathttp://www.devpro.it/xmlsocket/. I wanna use the browser only as client to visualize all elements. On 12 Ян, 23:56, Balazs Endresz balazs.endr...@gmail.com wrote: Server side animation? What application is that? :) I'd be really interested why would you do that, but I'd suggest using .animate() for each coordinate you get from the server instead of setting its height and width. And send coordinates less frequently -- maybe just once and do the computation on the client. Also, maybe this will be helpful too:http://groups.google.com/group/jquery-en/browse_thread/thread/51fe8e8... On Jan 12, 3:02 pm, meneldor menel...@gmail.com wrote: Hi, group. Im trying to make animation using jquery, but its controlled server side using XMLSocket. When jQuery receive coordinates from server it moving my DIV across the browser but its too fast. I cant understand how to do smooth animation. My server script (perl) compute the same x,y coordinates like jquery (i saw how in jQuery core) but i dont know how jquery delay all these x and y coordinates properly to make animation smooth. Ill be happy if someone explain me how it works. Excuse me for my english. Best Regards!
[jQuery] Multiple instace of Dialog
Hi, Im building a search engine for my website. And i want to have a button on each searchresult that a dilog will showup with more info. Like this: Searchresult: Google.se (button) -- Yahoo.com (button) and so on... But i dont know how to crate a dynamic javascript for the dialog function. AS i understand it when u do like this. script language=javascript type=text/javascript $(document).ready(function() { // Tell jQuery that our div is to be a dialog $('#dialogTest').addClass('flora').dialog({ autoOpen: false }); $('#bttn1').click(function() { $('#dialogTest').dialog('open'); }); }); /script Its static only to the bttn1. Who to do the script dynamic to work with every ID bttn1?
[jQuery] Help needed with Jquery Slideviewer: Making images change onclick
Hi I'm very new too website design and building, but have managed to hack together a website for my g/f as a Christmas present. Unfortunately being a woman she pointed out a whole lot of changes that she wanted made. One of those changes I just can't seem to get right. There are three galleries on the site that use Jquery Slideviewer 1.1. http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html I would like to have used JqGalScroll by Benjamin Sterling, but I struggled with it and couldn't get it working. http://benjaminsterling.com/jquery-jqgalscroll-photo-gallery/ What I would like to do can be achieved using Sterlings plugin as seen here: http://www.ryanbrenizer.com/portrait# However as mentioned I couldn't get that plugin to work for me, either because of the css involved or the plugin itself. My question is, would it be possible to add the ability to click the image and they change to the Jquery Slideviewer code? or should I keep plugging away at trying to get Sterlings plugin to work.. which at the moment seems hopeless for my limited skillset (I'm a copywriter!) You can see an example of the website I am building at: www.tessaholding.co.za/check/home.html Thanks in advance for any help rendered. Sincerely Craig
[jQuery] Re: Smooth animation
Thanks for your answers. Ill check the discussion you mentioned. 2009/1/13 Balazs Endresz balazs.endr...@gmail.com It's hard to tell anything else than I've just said based on this information. If you use .animate() with each coordinates you get then you have to set the duration to a smaller number as jQuery queues up sequential animations by default, so the new one is only executed if the previous one is finished. This makes the animation smoother but it will react slower to sudden changes in the movement depending on the duration. You can also stop the current animation as you get new coordinates and start an other one based on them. For smooth movements animating is also necessary even if you update the position on every mousemove event (see the discussion I mentioned). But using purely the server for smooth animations ... I don't really now how fast web sockets are (network connection and CPU time used) but it sounds a bit hard to carry out -- at least for me :) On Jan 12, 11:11 pm, meneldor menel...@gmail.com wrote: I compute where to move my object server side for better control. I use thathttp://www.devpro.it/xmlsocket/. I wanna use the browser only as client to visualize all elements. On 12 Ян, 23:56, Balazs Endresz balazs.endr...@gmail.com wrote: Server side animation? What application is that? :) I'd be really interested why would you do that, but I'd suggest using .animate() for each coordinate you get from the server instead of setting its height and width. And send coordinates less frequently -- maybe just once and do the computation on the client. Also, maybe this will be helpful too: http://groups.google.com/group/jquery-en/browse_thread/thread/51fe8e8... On Jan 12, 3:02 pm, meneldor menel...@gmail.com wrote: Hi, group. Im trying to make animation using jquery, but its controlled server side using XMLSocket. When jQuery receive coordinates from server it moving my DIV across the browser but its too fast. I cant understand how to do smooth animation. My server script (perl) compute the same x,y coordinates like jquery (i saw how in jQuery core) but i dont know how jquery delay all these x and y coordinates properly to make animation smooth. Ill be happy if someone explain me how it works. Excuse me for my english. Best Regards!
[jQuery] hoverIntent like delays when using mouseenter, mouseleave
Is it possible to setup hoverIntent like delays when using mouseenter, mouseleave? I did some digging in to hoverIntent, but didn't see any support for the mouseenter/mouseleave triggers. Is there a way to do this in Jquery? I've got the following bit of code triggering a menu, but I'd like a small delay on triggering, since the div that is being load is a menu, and with the fade-in, I want to be sure the user intended to call the menu. jQuery.fn.fadeToggle = function(speed, easing, callback) { return this.animate({opacity: 'toggle'}, speed, easing, callback); }; $(li.main-nav).bind(mouseenter mouseleave, function(){ $(this).children('div').fadeToggle(); $(this).toggleClass('menu-on'); return false; });
[jQuery] Re: anyone knows vertical carousel ?
you're welcome. as you look through the code, keep in mind that I added the ajax stuff for pulling in large images at the very end of the process, and I'm sure it could be done a lot more elegantly. A number of people on the list have offered better solutions, in fact. If that part of the code is a concern for you, try doing a search in the google group for preload images or lazy loading or some such keyword combination. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 13, 2009, at 3:58 AM, merihsaka...@yahoo.com wrote: Hi Brian and MorningZ, There is nothing problem with first example.. I just wanted to see different examples.. Thank you about that.. and thank you Karl, This is exactly what I am looking for.. I haven't tried yet, I will try it..
[jQuery] Re: IE Problem with (function($)
I'm not seeing anything obvious. Taking a stab in the dark here ... I've received a similar error in the past when a reference to one of my JavaScript files was resulting in a 404. The browser would try to parse the file as JavaScript, but of course it would be met with a syntax error on line 1. Is it possible that the problem is not with this file, but with another one that you're trying to include? Just a guess. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 13, 2009, at 5:35 AM, Aryan wrote: I have a problem with Internet Explorer ( all versions ) . The following is my JQuery Code , which executes perfectly in mozilla and chrome.. But it doesn't work in Internet Explorer. It says : Syntax error ( line 1 )... Can anyone help me out here.. Thanks for your time in reading this. (function($){ var EYE = window.EYE = function() { var _registered = { init: [] }; return { init: function() { $.each(_registered.init, function(nr, fn){ fn.call(); }); }, extend: function(prop) { for (var i in prop) { if (prop[i] != undefined) { this[i] = prop[i]; } } }, register: function(fn, type) { if (!_registered[type]) { _registered[type] = []; } _registered[type].push(fn); } }; }(); $(EYE.init); })(jQuery);
[jQuery] Resizable() work incorrectly with Iframe in all browsers
Hi guys. I have a problem with the resizable() function. When its use with iframe, vertical resizing work incorrectly. Who knows how fix it? Here is the code: html head titletitle/title style type=text/css body { padding: 0; margin: 0; } #resizeDiv { background: #EEE; width: 100%; height: 170px; border-top: 1px solid #CCC; position: absolute; bottom: 0; z-index: 2; } iframe { z-index: 1; } /style script src=js/jquery.js type=text/javascript/script script src=js/ui.core.js type=text/javascript/script script src=js/ui.dialog.js type=text/javascript/script script src=js/ui.resizable.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $('#resizeDiv').resizable({ handles: 'n' }); }); /script /head body div id=container div class=site iframe src=http://google.com; frameborder=0 scrolling=no height=100% width=100%/iframe /div div id=resizeDiv/div /div /body /html Thank you
[jQuery] Resizable() work incorrectly with Iframe
Hi guys. I have a problem with the resizable() function. When its use with iframe, vertical resizing work incorrectly. Who knows how fix it? Here is the code: html head titletitle/title style type=text/css body { padding: 0; margin: 0; } #resizeDiv { background: #EEE; width: 100%; height: 170px; border-top: 1px solid #CCC; position: absolute; bottom: 0; z-index: 2; } iframe { z-index: 1; } /style script src=js/jquery.js type=text/javascript/script script src=js/ui.core.js type=text/javascript/script script src=js/ui.dialog.js type=text/javascript/script script src=js/ui.resizable.js type=text/javascript/script script type=text/javascript $(document).ready(function(){ $('#resizeDiv').resizable({ handles: 'n' }); }); /script /head body div id=container div class=site iframe src=http://google.com; frameborder=0 scrolling=no height=100% width=100%/iframe /div div id=resizeDiv/div /div /body /html Thank you
[jQuery] getJSON problem - Urgent
Hi, I've got a deadline to get a project working and I'm stuck with a getJSON call problem. Here's what's happening. Visitors come to a landing page on domain A (domaina.com). All of the links and form submits on this page are coded with a javascript call to a function which calls getJSON on a completey different domain (domainb.com). The format of the onclick is like this: a href=page.html onclick=jsoncall(value);Go somewhere on Domain A/a The format of the getJSON call is like this: jQuery.getJSON(http://domainb.com/logclick.php?value=; + value + transaction= +transactionid); where the value is the passed value and transactionid is an identifier of the visitor to the page. Problem is the logging of the click is intermitent. Sometimes it gets logged and sometimes it doesn't. I'm sure this problem has to do with my misunderstanding of how the onclick works. I had assumed that the onclick would always complete fire before the link goes to the new page. It seems as if this is not the case. Sometimes the getJSON appears to be called and sometimes it doesn't. And, I need to make sure ALL of those clicks get tracked somehow. Any help woud be greatly appreciated. I'm hoping someone has run across a similar problem. Thanks so much, Guy
[jQuery] jQuery Interface - Multiple Windows (Chrome/Safari problems...)
Hi all, I'm fairly new to jQuery (and CSS, come to think of it!), so this question might have a very simple fix, but I'm at my wits end with two browsers (Google Chrome Safari [both on PC]). I'm using the Interface plugin (http://interface.eyecon.ro/). The site in question is here: http://www.deadredhour.com/temp/sandbox/skinning.html CSS here: http://www.deadredhour.com/temp/sandbox/wEXAMPLEindows.css In Firefox 3, IE 7 and Opera 9.5, everything's all okay. I've managed to get multiple windows to open, depending on what link is clicked at the bottom of the page, each one is draggable, resizable and can be rolled up and down. Some positioning in the CSS still needs to be amended, of course, but it's still early days! Moving into Chrome and Safari, a few bugs have appeared. Mainly that when more than one window is open, instead of stacking on-top/behind each other, they stack vertically, ending up with some being off the page. Then when some are rolled up, the windows below it move vertically upwards also. On closing a window (with multiple windows open), the windows that remain open jump to a seemingly random position on the page... I have a feeling that it's a CSS-based issue, but it's incredibly perplexing. Any help on this would be very welcome indeed. Let me know if code samples or any further info is needed. Thanks in advance, Luke.
[jQuery] jQuery Interface - Multiple Windows (Chrome/Safari problems...)
Hi all, I'm fairly new to jQuery (and CSS, come to think of it!), so this question might have a very simple fix, but I'm at my wits end with two browsers (Google Chrome Safari [both on PC]). I'm using the Interface plugin (http://interface.eyecon.ro/). The site in question is here: http://www.deadredhour.com/temp/sandbox/skinning.html CSS here: http://www.deadredhour.com/temp/sandbox/wEXAMPLEindows.css In Firefox 3, IE 7 and Opera 9.5, everything's all okay. I've managed to get multiple windows to open, depending on what link is clicked at the bottom of the page, each one is draggable, resizable and can be rolled up and down. Some positioning in the CSS still needs to be amended, of course, but it's still early days! Moving into Chrome and Safari, a few bugs have appeared. Mainly that when more than one window is open, instead of stacking on-top/behind each other, they stack vertically, ending up with some being off the page. Then when some are rolled up, the windows below it move vertically upwards also. On closing a window (with multiple windows open), the windows that remain open jump to a seemingly random position on the page... I have a feeling that it's a CSS-based issue, but it's incredibly perplexing. Any help on this would be very welcome indeed. Let me know if code samples or any further info is needed. Thanks in advance, Luke.
[jQuery] Re: jQuery Form Plugin - after ajaxSubmit call, ajax submitting seems to be disabled
malsup wrote: Sorry, I read your first message too quickly. Is 'edit_card_jq' bound as a submit handler? If so, you should return false form that fn. If not, could you post a little more code or provide a link? Here's a link that shows what I'm doing: http://blueapples.org/test/forms/ I figured out what my problem was however. I was trying to call ajaxForm like this: $('#edit_card form').ajaxSubmit('#edit_card', function() { alert('Loaded'); edit_card_jq(); }); Instead of the proper way using an options dictionary: $('#edit_card form').ajaxSubmit({ target: '#edit_card', success: function() { alert('Loaded'); edit_card_jq(); } }); My mistake but I sure with Javascript would have complained about it. Oh well, figured it out! Sorry to waste your time. -- View this message in context: http://www.nabble.com/jQuery-Form-Plugin---after-ajaxSubmit-call%2C-ajax-submitting-seems-to-be-disabled-tp21424793s27240p21437053.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: using setTimeout to apply fade-in effect to multiple divs in sequence
Thank you so much for the reply. I had figured it out but your way is much more elegant. here's what I had done: $(.box).hide(); var currentBox = $(#container :first-child); fadeMyBoxes(currentBox); function fadeMyBoxes(thisbox){ thisbox.fadeIn('slow'); if (thisbox.is(:last-child)){ clearTimeout(t); } else { var t =setTimeout( function(){fadeMyBoxes(thisbox.next());},50); } }; On Jan 10, 10:04 am, Balazs Endresz balazs.endr...@gmail.com wrote: It can be done with setInterval too but doing it recursively withsetTimeoutis a bit better: var i=0, elements=$('.box'), length=elements.length; functionfade(delay){ elements.eq(i++).fadeOut(); if(i=length) setTimeout(arguments.callee, delay); //arguments.callee is a reference to the current function } fade(500); On Jan 10, 3:05 am, legofish pen...@gmail.com wrote: Hi, I have 20 divs all with the class .box on my page. I want to apply the fadeIn() effect to all of them. I dont want them to allfadein at the same time. I want them tofade-in one by one, with a slight time offset. I dont want to use callback functions, because I dont want to wait until thefadeis completely finished on one div before fading the next div. I want thefadeeffect on the next div to start a short time after the effect on the previous one has started. So I think I need to usesetTimeoutand some kind of a recursive method, but I'm not very good with JS so I was hoping someone would find this trivial and could help answer my question. my thanks in advance.
[jQuery] Re: To check if an element value is of a particular class type
$('.emailSuffix').click(function(){ var field = $('#element'); if (field.val() == 'something'){ //ok } else { //not ok } }); On Jan 13, 7:39 am, Santo pujari.sant...@gmail.com wrote: Hello All This is what I am trying to do. I have defined an email suffix class for a particular textbox element so that it accepts values for that particular class. Whenever there is a different value inserted, it displays a jquery error. Now, there also is an Add button which should add the value and display it in a widget list if it is a valid value. So, I need to check and insert an if else block on the click event of the add button to check if the value inserted in the textbox is a valid email suffix type. How do I check that something like if ($(#element_id).val.className == emailSuffix) { ... } else { ... }
[jQuery] Re: jQuery scripts not working with php ext.
Both look alright here, except that the SSI version is throwing an error right under the main slideshow. On Jan 13, 3:10 am, Mikehobo mikehobi...@gmail.com wrote: Hello, On the site I am working on (http://www.pjhconstruction.net/) I have a couple scripts that I am using. Anyways at the moment I am using an shtml extension and using ssi's. I need to be able to convert the site to be using PHP and use php includes. My problem lies with all of my jQuery scripts not functioning anymore. If you go tohttp://www.pjhconstruction.net/index.shtml, you'll see the image rotator and the collapsed div navigation all working. But, if you go tohttp://www.pjhconstruction.net/index.php, it's a whole 'nother story. The image rotator is not functioning (and replaced with black div), and if you click the navigation links you will get nothing! I am just wondering, what is happening. It is not my server either, I have tested on two different servers. Maybe there is error in my html or something. I'm just really confused. Thanks, Mike
[jQuery] Re: Javascript performance testing? In need of some help...
http://www.letmegooglethatforyou.com/?q=event+delegation On Jan 13, 2:39 am, websiteguy2...@gmail.com websiteguy2...@gmail.com wrote: Hello: We have an ajax/js-heavy website that relies on Jquery. Some of the events throughout the site seem to get sluggish as the objects on the page grow. Is anyone interested in a consultative gig to look through our site and point to ways to improve our Jquery implementation, etc? You can decide if an hourly rate or project fee is most applicable once we discuss more - we'll happily pay a competitive rate. Please send over any sites you've worked on, or what your qualifications are. Thanks. Websiteguy websiteguy2...@gmail.com
[jQuery] Re: To check if an element value is of a particular class type
Your problem isn't very clear but regardless, there is a .hasClass function http://docs.jquery.com/Attributes/hasClass#class so $(#element_id).hasClass(emailSuffix) would give you true/false . . . On Jan 13, 4:39 am, Santo pujari.sant...@gmail.com wrote: Hello All This is what I am trying to do. I have defined an email suffix class for a particular textbox element so that it accepts values for that particular class. Whenever there is a different value inserted, it displays a jquery error. Now, there also is an Add button which should add the value and display it in a widget list if it is a valid value. So, I need to check and insert an if else block on the click event of the add button to check if the value inserted in the textbox is a valid email suffix type. How do I check that something like if ($(#element_id).val.className == emailSuffix) { ... } else { ... }
[jQuery] How to Validate Forms in both sides using PHP and jQuery
Hi there guys! I have finished a new tutorial for yensdesign.com We are going to learn how to validate your forms using PHP and jQuery in both sides: client side (using javascript with jQuery) and server side (using PHP). This is the link: http://yensdesign.com/2009/01/how-validate-forms-both-sides-using-php-jquery/ I hope you find it useful!
[jQuery] Re: using setTimeout to apply fade-in effect to multiple divs in sequence
I've actually made a bit nicer abstraction as a jQuery plugin a while ago, I think it's much more useful for such things, I almost forgot about it: http://jsbin.com/unini/edit This is how your code looks like with it: $(#container :first-child).asyncEach(function(){ $(this).fadeIn('slow'); }, 500); No global variables, can be reused on multiple elements, you can stop it, add custom easing and there's a `complete` callback function too! On Jan 13, 3:49 pm, legofish pen...@gmail.com wrote: Thank you so much for the reply. I had figured it out but your way is much more elegant. here's what I had done: $(.box).hide(); var currentBox = $(#container :first-child); fadeMyBoxes(currentBox); function fadeMyBoxes(thisbox){ thisbox.fadeIn('slow'); if (thisbox.is(:last-child)){ clearTimeout(t); } else { var t =setTimeout( function(){fadeMyBoxes(thisbox.next());},50); } }; On Jan 10, 10:04 am, Balazs Endresz balazs.endr...@gmail.com wrote: It can be done with setInterval too but doing it recursively withsetTimeoutis a bit better: var i=0, elements=$('.box'), length=elements.length; functionfade(delay){ elements.eq(i++).fadeOut(); if(i=length) setTimeout(arguments.callee, delay); //arguments.callee is a reference to the current function } fade(500); On Jan 10, 3:05 am, legofish pen...@gmail.com wrote: Hi, I have 20 divs all with the class .box on my page. I want to apply the fadeIn() effect to all of them. I dont want them to allfadein at the same time. I want them tofade-in one by one, with a slight time offset. I dont want to use callback functions, because I dont want to wait until thefadeis completely finished on one div before fading the next div. I want thefadeeffect on the next div to start a short time after the effect on the previous one has started. So I think I need to usesetTimeoutand some kind of a recursive method, but I'm not very good with JS so I was hoping someone would find this trivial and could help answer my question. my thanks in advance.
[jQuery] Re: Cycle Pluging next up text
I actually fiddled around with it a bit and I think I have it fixed. I added in a couple more lines and it seems to find the right slide name: else if (!fwd index == 0) $nextSlide = $slides.eq(opts.slideCount-1); Unfortunately, I don't think I like how it works now! It seems strange that the upcoming slide changes depending on the direction you're going in... so I may just make the next/previous buttons disappear per your demo at http://www.malsup.com/jquery/cycle/after.html Thanks again! On Jan 12, 4:21 pm, amuhlou amysch...@gmail.com wrote: Thanks much, that just about does it! The only issue I've found is that $nextSlide becomes undefined if paging backwards. For example:http://static.spartaninternet.com/sandbox/ If you click the back button to get to slide 1 it becomes undefined. ~amy On Jan 12, 3:56 pm, Mike Alsup mal...@gmail.com wrote: function onAfter(currSlideElement, nextSlideElement, options, forwardFlag) { $('#main').html(this.alt); }}); Ideally, in my onAfter callback I would like to have the upcoming image's alt text instead of the current one's. Is this possible? Thanks! ~Amy Hmm, a bit tricky but this might get the job done: function onAfter(curr,next,opts,fwd) { var $slides = $(this).parent().children(); var index = $slides.index(this); var $nextSlide; if (fwd index == (opts.slideCount - 1)) $nextSlide = $slides.eq(0); else if (fwd) $nextSlide = $slides.eq(index+1); else if (opts.slideCount == 0) $nextSlide = $slides.eq(opts.slideCount-1); else $nextSlide = $slidex.eq(index-1) $('#main').html($nextSlide.attr('alt')); } Disclaimer: this won't work if you're using the 'slideExpr' option. Mike
[jQuery] Event code in different .js files
I'm relatively new to jQuery and ran into a problem. I use a framework (CakePHP) and want some of my jQuery to be included by the layout (the general template for the site) and some by the current view (which is page specific). This means the actual html page will use two (or more) .js files. I need to put everything in $(window).bind('load', function () {} to make sure my jQuery is executed after loading all images. However, I assume if I do this in two different .js files, the second one will replace the first one. So the question: how can I use $(window).bind ('load', function () {} in multiple .js files?
[jQuery] Rotating images AJAX like on a page
I'm looking to produce functionality just like what's displayed here (http://medienfreunde.com/lab/innerfade/) in the A list with images and links section. I downloaded the JQuery plugin supplied but it was giving me problems with IE7. It worked fine with FF3 and Safari. So, does anyone know how I can replicate this using Rails and JQuery?
[jQuery] Masked Input Plugin
I need a customization in my mask. The mask does not have a fixed format. As the user types in the it can be changed. The year(after the bar) can be with 2 or 4 digits. Initial mask 9.99/99-99 If the user type another character mask must change to 9.99/-99 versions: Masked Input Plugin 1.2.1 Richfaces 3.2.1.GA Tks, Joel Lobo blogdojoellobo.blogspot.com Fortaleza - Brazil
[jQuery] $('.classname') returns NULL in IE
I have a document which is almost valid HTML (with the HTML 4 transitional doctype), the only warnings I'm currently getting are about ampersands in query strings. When I try $('.classname') in every browser I get the object expected, in IE 6 7 I get null, I've also tried $('#someId') and get the same issue (and document.getElementById('someId') works fine in IE). Am I going crazy or is there something I'm missing?
[jQuery] .animate() queue without pause between animations
I'm using .animate() for a rotating navigation menu of 5 items, where the currently selected item is in the center. When I click on an icon next to the central everything works ok, but when I click on an icon to the far left or far right, two calls to .animate() are needed per icon for all icons to move correctly. The problem is that there is about a second of pause between the two animations for the same icon when I set queue: true. The effect is the same if I put the other call to .animate() into callback function of the first. Is there any way to get a seamless animation using multiple calls to .animate()? I tried queue: false but, as expected, the second call to .animate() will interrupt the first and the icons will not move correctly.
[jQuery] Code simplification?
Hi, I'm new to jQuery and liking what I've seen so far. I'm curious as to whether I can reduce my code, using chaining perhaps? Example... $('.nav_company').hoverIntent(function() { // toggle display of company sub menu content panel $('.nav_sub_default').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_company').removeClass('offscreen').addClass ('onscreen'); $('.nav_sub_products').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_markets').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_tools_support').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_news_events').removeClass('onscreen').addClass ('offscreen'); },function(){ return false; }); Based on the fact that there are 6 menu items (nav_sub_x) - I currently have the above code entered 6 times to add and remove the necessary classes from each of the relevant DIVs on the page. Is there a cleaner way to do this? Many thanks in advance. Cheers, Rob
[jQuery] Re: Code simplification?
You could add the offscreen class to the appropriate menu item and then remove the sibling classes all at once $(.nav_sub_products).siblings().removeClass('onscreen'); You would just have to be sure that all the menu items are true siblings. On Tue, Jan 13, 2009 at 11:36 AM, r...@lighthouseuk.net r...@50-tuning.comwrote: Hi, I'm new to jQuery and liking what I've seen so far. I'm curious as to whether I can reduce my code, using chaining perhaps? Example... $('.nav_company').hoverIntent(function() { // toggle display of company sub menu content panel $('.nav_sub_default').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_company').removeClass('offscreen').addClass ('onscreen'); $('.nav_sub_products').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_markets').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_tools_support').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_news_events').removeClass('onscreen').addClass ('offscreen'); },function(){ return false; }); Based on the fact that there are 6 menu items (nav_sub_x) - I currently have the above code entered 6 times to add and remove the necessary classes from each of the relevant DIVs on the page. Is there a cleaner way to do this? Many thanks in advance. Cheers, Rob
[jQuery] Re: getJSON problem - Urgent
Are any of these links dynamically generated? That is, are any of them not in the page when its first loaded for the user? It may be a binding issue. On Tue, Jan 13, 2009 at 8:05 AM, g...@getsharepoint.com g...@getsharepoint.com wrote: Hi, I've got a deadline to get a project working and I'm stuck with a getJSON call problem. Here's what's happening. Visitors come to a landing page on domain A (domaina.com). All of the links and form submits on this page are coded with a javascript call to a function which calls getJSON on a completey different domain (domainb.com). The format of the onclick is like this: a href=page.html onclick=jsoncall(value);Go somewhere on Domain A/a The format of the getJSON call is like this: jQuery.getJSON(http://domainb.com/logclick.php?value=; + value + transaction= +transactionid); where the value is the passed value and transactionid is an identifier of the visitor to the page. Problem is the logging of the click is intermitent. Sometimes it gets logged and sometimes it doesn't. I'm sure this problem has to do with my misunderstanding of how the onclick works. I had assumed that the onclick would always complete fire before the link goes to the new page. It seems as if this is not the case. Sometimes the getJSON appears to be called and sometimes it doesn't. And, I need to make sure ALL of those clicks get tracked somehow. Any help woud be greatly appreciated. I'm hoping someone has run across a similar problem. Thanks so much, Guy
[jQuery] Re: getJSON problem - Urgent
All of the links are hard coded. Someone on another board suggested I use the click event handler instead. Problem is the links vary in value so I'd probably have to wait until the document loaded then grab anything with an Onclick attrib containing that code, remove the attribute and attach the click event handler. Thanks. On Jan 13, 12:10 pm, brian bally.z...@gmail.com wrote: Are any of these links dynamically generated? That is, are any of them not in the page when its first loaded for the user? It may be a binding issue. On Tue, Jan 13, 2009 at 8:05 AM, g...@getsharepoint.com g...@getsharepoint.com wrote:
[jQuery] Re: Masked Input Plugin
I think this misses the point of having a mask. You should decide which format *you* want the data in and force the user to follow suit. Probably the best way in your case would be to force 4 digits for the year. Unless, of course, you're dealing with existing IDs or something, where the year might be either 2 or 4 digits. That would kind of suck. On Tue, Jan 13, 2009 at 9:59 AM, Joel Lobo joell...@gmail.com wrote: I need a customization in my mask. The mask does not have a fixed format. As the user types in the it can be changed. The year(after the bar) can be with 2 or 4 digits. Initial mask 9.99/99-99 If the user type another character mask must change to 9.99/-99 versions: Masked Input Plugin 1.2.1 Richfaces 3.2.1.GA Tks, Joel Lobo blogdojoellobo.blogspot.com Fortaleza - Brazil
[jQuery] What am I getting this error?
Hi, all... Why am I getting this error: missing ; before statement var tour-info-div = '$('this').prev('.tour-info-div')' ; \n from this code: ??? $(document).ready(function() { $('.update_button').click(function(){ var formval = { tour_url: $('this').prev('.update_input').val() , mls_number: $('this').prev('.tour-div-info').attr('id').val() } ; var tour-info-div = '$('this').prev('.tour-info-div')' ; var update-div = '$('this').prev('.update-div')' ; $.ajax({ cache: false, type: POST, url: ../components/virtual_tours.cfc?method=update_tourreturnFormat=json, dataType: json, data: formval, success: function(response) { if (response.update == Update Successful) { $('update-div').hide(); $('tour-info-div').load(???).show(); } else { $('#unsuccessful').empty().fadeIn(500).append(response.update) }; } }); }); });
[jQuery] Re: What am I getting this error?
You have too many quotes in these 2 lines: var tour-info-div = '$('this').prev('.tour-info-div')' ; var update-div = '$('this').prev('.update-div')' ; try: var tour-info-div = $(this).prev('.tour-info-div') ; var update-div = $(this).prev('.update-div'); On Tue, Jan 13, 2009 at 12:29 PM, Rick Faircloth r...@whitestonemedia.com wrote: Hi, all... Why am I getting this error: missing ; before statement var tour-info-div = '$('this').prev('.tour-info-div')' ; \n from this code: ??? $(document).ready(function() { $('.update_button').click(function(){ var formval = { tour_url: $('this').prev('.update_input').val() , mls_number: $('this').prev('.tour-div-info').attr('id').val() } ; var tour-info-div = '$('this').prev('.tour-info-div')' ; var update-div = '$('this').prev('.update-div')' ; $.ajax({ cache: false, type: POST, url: ../components/virtual_tours.cfc?method=update_tourreturnFormat=json, dataType: json, data: formval, success: function(response) { if (response.update == Update Successful) { $('update-div').hide(); $('tour-info-div').load(???).show(); } else { $('#unsuccessful').empty().fadeIn(500).append(response.update) }; } }); }); });
[jQuery] Re: IE Problem with (function($)
may be i should check with the other files and let you know... thanks for the information.. Cheers ! Aryan On Tue, Jan 13, 2009 at 7:06 PM, Karl Swedberg k...@englishrules.comwrote: I'm not seeing anything obvious. Taking a stab in the dark here ... I've received a similar error in the past when a reference to one of my JavaScript files was resulting in a 404. The browser would try to parse the file as JavaScript, but of course it would be met with a syntax error on line 1. Is it possible that the problem is not with this file, but with another one that you're trying to include? Just a guess. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 13, 2009, at 5:35 AM, Aryan wrote: I have a problem with Internet Explorer ( all versions ) . The following is my JQuery Code , which executes perfectly in mozilla and chrome.. But it doesn't work in Internet Explorer. It says : Syntax error ( line 1 )... Can anyone help me out here.. Thanks for your time in reading this. (function($){ var EYE = window.EYE = function() { var _registered = { init: [] }; return { init: function() { $.each(_registered.init, function(nr, fn){ fn.call(); }); }, extend: function(prop) { for (var i in prop) { if (prop[i] != undefined) { this[i] = prop[i]; } } }, register: function(fn, type) { if (!_registered[type]) { _registered[type] = []; } _registered[type].push(fn); } }; }(); $(EYE.init); })(jQuery);
[jQuery] Re: What am I getting this error?
Thanks for the reply, Brian, but that didn't solve it. I figured I had a case of quotitus :o) Here's what I have now (even took quote out of the top (this)) and still get the same error: $(document).ready(function() { $('.update_button').click(function(){ var formval= { tour_url:$(this).prev('.update_input').val(), mls_number: $(this).prev('.tour-div-info').attr('id').val() }; var tour-info-div = $(this).prev('.tour-info-div'); var update-div = $(this).prev('.update-div'); etc... Any other ideas/suggestions? Thanks, Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of brian Sent: Tuesday, January 13, 2009 12:39 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: What am I getting this error? You have too many quotes in these 2 lines: var tour-info-div = '$('this').prev('.tour-info-div')' ; var update-div = '$('this').prev('.update-div')' ; try: var tour-info-div = $(this).prev('.tour-info-div') ; var update-div = $(this).prev('.update-div'); On Tue, Jan 13, 2009 at 12:29 PM, Rick Faircloth r...@whitestonemedia.com wrote: Hi, all... Why am I getting this error: missing ; before statement var tour-info-div = '$('this').prev('.tour-info-div')' ; \n from this code: ??? $(document).ready(function() { $('.update_button').click(function(){ var formval = { tour_url: $('this').prev('.update_input').val() , mls_number: $('this').prev('.tour-div-info').attr('id').val() } ; var tour-info-div = '$('this').prev('.tour-info-div')' ; var update-div = '$('this').prev('.update-div')' ; $.ajax({ cache: false, type: POST, url: ../components/virtual_tours.cfc?method=update_tourreturnFormat=json, dataType: json, data: formval, success: function(response) { if (response.update == Update Successful) { $('update-div').hide(); $('tour-info-div').load(???).show(); } else { $('#unsuccessful').empty().fadeIn(500).append(response.update) }; } }); }); });
[jQuery] Re: What am I getting this error?
Escape your quotes or use a different quote Escape quote var tour-info-div = '$(\'this\').prev(\'.tour-info-div\')' ; var update-div = '$(\'this\').prev(\'.update-div\')' ; Use double quote var tour-info-div = $('this').prev('.tour-info-div'); var update-div = $('this').prev('.update-div'); On Jan 13, 10:25 am, Rick Faircloth r...@whitestonemedia.com wrote: Thanks for the reply, Brian, but that didn't solve it. I figured I had a case of quotitus :o) Here's what I have now (even took quote out of the top (this)) and still get the same error: $(document).ready(function() { $('.update_button').click(function(){ var formval = { tour_url:$(this).prev('.update_input').val(), mls_number: $(this).prev('.tour-div-info').attr('id').val() }; var tour-info-div = $(this).prev('.tour-info-div'); var update-div = $(this).prev('.update-div'); etc... Any other ideas/suggestions? Thanks, Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of brian Sent: Tuesday, January 13, 2009 12:39 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: What am I getting this error? You have too many quotes in these 2 lines: var tour-info-div = '$('this').prev('.tour-info-div')' ; var update-div = '$('this').prev('.update-div')' ; try: var tour-info-div = $(this).prev('.tour-info-div') ; var update-div = $(this).prev('.update-div'); On Tue, Jan 13, 2009 at 12:29 PM, Rick Faircloth r...@whitestonemedia.com wrote: Hi, all... Why am I getting this error: missing ; before statement var tour-info-div = '$('this').prev('.tour-info-div')' ; \n from this code: ??? $(document).ready(function() { $('.update_button').click(function(){ var formval = { tour_url: $('this').prev('.update_input').val() , mls_number: $('this').prev('.tour-div-info').attr('id').val() } ; var tour-info-div = '$('this').prev('.tour-info-div')' ; var update-div = '$('this').prev('.update-div')' ; $.ajax({ cache: false, type: POST, url: ../components/virtual_tours.cfc?method=update_tourreturnFormat=json, dataType: json, data: formval, success: function(response) { if (response.update == Update Successful) { $('update-div').hide(); $('tour-info-div').load(???).show(); } else { $('#unsuccessful').empty().fadeIn(500).append(response.update) }; } }); }); });
[jQuery] Re: Once validated..
I see, you set a js var to equal the var in php, that's very good to know. Thank you.
[jQuery] html() function remove attribute double quote in IE
alert( $(content).html() ); - html code: div id=content a id=link href=http://www.google.ca; target=_newtest link/a a id=link2 href=http://www.google.ca; target=_newtest link2/a /div - it will return in IE6 A id=link href=http://www.google.ca; target=_newtest link/A A id=link2 href=http://www.google.ca; target=_newtest link2/A - can we get the html with double quote around the html attribute ?
[jQuery] Re: .animate() queue without pause between animations
It's hard to tell without having a look at the code. You may want to try http://paste.pocoo.org to post code like this. Are you chaining the animations? ie. $(this).animate({},speed).animate ({},speed).animate({},speed); You could always try setting a delay on your second animation with setTimeout. setTimeout ('$(this).animate({},speed)', 400); Hope that helps. Nikola
[jQuery] Re: $('.classname') returns NULL in IE
Without seeing more of your HTML, it's next to impossible to recommend anything. if document.getElementById(someid) references something and $ (#someid) doesn't, then that points to jQuery not being properly loaded and/or used On Jan 13, 10:06 am, DEfusion david.sp...@gmail.com wrote: I have a document which is almost valid HTML (with the HTML 4 transitional doctype), the only warnings I'm currently getting are about ampersands in query strings. When I try $('.classname') in every browser I get the object expected, in IE 6 7 I get null, I've also tried $('#someId') and get the same issue (and document.getElementById('someId') works fine in IE). Am I going crazy or is there something I'm missing?
[jQuery] Re: Code simplification?
If you have control on the HTML, it would be a LOT easier/cleaner/make- more-sense if you separate classes for instance li class=nav_sub_default/li li class=nav_sub_company/li li class=nav_sub_products/li to li class=nav_sub default/li li class=nav_sub company/li li class=nav_sub products/li That would make your jQuery life much easier, plus it makes the items actually have common class characteristics Now when you want to manipulate them all: $(li.nav_sub).doSomejQueryAction and yet they all still have their unique styles/characteristics On Jan 13, 12:01 pm, Diane Nardozzi diane...@gmail.com wrote: You could add the offscreen class to the appropriate menu item and then remove the sibling classes all at once $(.nav_sub_products).siblings().removeClass('onscreen'); You would just have to be sure that all the menu items are true siblings. On Tue, Jan 13, 2009 at 11:36 AM, r...@lighthouseuk.net r...@50-tuning.comwrote: Hi, I'm new to jQuery and liking what I've seen so far. I'm curious as to whether I can reduce my code, using chaining perhaps? Example... $('.nav_company').hoverIntent(function() { // toggle display of company sub menu content panel $('.nav_sub_default').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_company').removeClass('offscreen').addClass ('onscreen'); $('.nav_sub_products').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_markets').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_tools_support').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_news_events').removeClass('onscreen').addClass ('offscreen'); },function(){ return false; }); Based on the fact that there are 6 menu items (nav_sub_x) - I currently have the above code entered 6 times to add and remove the necessary classes from each of the relevant DIVs on the page. Is there a cleaner way to do this? Many thanks in advance. Cheers, Rob
[jQuery] Re: Event code in different .js files
However, I assume if I do this in two different .js files, the second one will replace the first one and your assumption is not correct javascript1.js - $(window).load(function() { alert(Alert in One); }); -- javascript2.js - $(window).load(function() { alert(Alert in Two); }); -- should give you two alert boxes On Jan 13, 11:41 am, Krommenaas krommen...@gmail.com wrote: I'm relatively new to jQuery and ran into a problem. I use a framework (CakePHP) and want some of my jQuery to be included by the layout (the general template for the site) and some by the current view (which is page specific). This means the actual html page will use two (or more) .js files. I need to put everything in $(window).bind('load', function () {} to make sure my jQuery is executed after loading all images. However, I assume if I do this in two different .js files, the second one will replace the first one. So the question: how can I use $(window).bind ('load', function () {} in multiple .js files?
[jQuery] Re: .animate() queue without pause between animations
Also, you might want to try posting questions like this one in the jQuery UI group as .animate is part of jQuery UI. http://groups.google.com/group/jquery-ui?hl=enpli=1
[jQuery] Re: What am I getting this error?
Nope...neither of those worked. I finally just gave up on creating vars from the code and used the straight code itself...no errors. Can't figure out why it wouldn't work to var them, however. Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Kean Sent: Tuesday, January 13, 2009 1:51 PM To: jQuery (English) Subject: [jQuery] Re: What am I getting this error? Escape your quotes or use a different quote Escape quote var tour-info-div = '$(\'this\').prev(\'.tour-info-div\')' ; var update-div = '$(\'this\').prev(\'.update-div\')' ; Use double quote var tour-info-div = $('this').prev('.tour-info-div'); var update-div = $('this').prev('.update-div'); On Jan 13, 10:25 am, Rick Faircloth r...@whitestonemedia.com wrote: Thanks for the reply, Brian, but that didn't solve it. I figured I had a case of quotitus :o) Here's what I have now (even took quote out of the top (this)) and still get the same error: $(document).ready(function() { $('.update_button').click(function(){ var formval = { tour_url:$(this).prev('.update_input').val(), mls_number: $(this).prev('.tour-div-info').attr('id').val() }; var tour-info-div = $(this).prev('.tour-info-div'); var update-div = $(this).prev('.update-div'); etc... Any other ideas/suggestions? Thanks, Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of brian Sent: Tuesday, January 13, 2009 12:39 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: What am I getting this error? You have too many quotes in these 2 lines: var tour-info-div = '$('this').prev('.tour-info-div')' ; var update-div = '$('this').prev('.update-div')' ; try: var tour-info-div = $(this).prev('.tour-info-div') ; var update-div = $(this).prev('.update-div'); On Tue, Jan 13, 2009 at 12:29 PM, Rick Faircloth r...@whitestonemedia.com wrote: Hi, all... Why am I getting this error: missing ; before statement var tour-info-div = '$('this').prev('.tour-info-div')' ; \n from this code: ??? $(document).ready(function() { $('.update_button').click(function(){ var formval = { tour_url: $('this').prev('.update_input').val() , mls_number: $('this').prev('.tour-div-info').attr('id').val() } ; var tour-info-div = '$('this').prev('.tour-info-div')' ; var update-div = '$('this').prev('.update-div')' ; $.ajax({ cache: false, type: POST, url: ../components/virtual_tours.cfc?method=update_tourreturnFormat=json, dataType: json, data: formval, success: function(response) { if (response.update == Update Successful) { $('update-div').hide(); $('tour-info-div').load(???).show(); } else { $('#unsuccessful').empty().fadeIn(500).append(response.update) }; } }); }); });
[jQuery] How to make this work for multiple elements with same class
Here's the code that I'm trying to make function for multiple links on a page with the class of update-link How would I change this to make it work for the specific .update-link element that I click? $(document).ready(function() { $('.update-link').click(function() { $('this').prev('.options').hide(); $('this').next('.update-div').fadeIn(500); }); }); Thanks, Rick
[jQuery] Re: How to make this work for multiple elements with same class
to start: you have $('this') it should be without the ticks $(this) On Jan 13, 2:50 pm, Rick Faircloth r...@whitestonemedia.com wrote: Here's the code that I'm trying to make function for multiple links on a page with the class of update-link How would I change this to make it work for the specific .update-link element that I click? $(document).ready(function() { $('.update-link').click(function() { $('this').prev('.options').hide(); $('this').next('.update-div').fadeIn(500); }); }); Thanks, Rick
[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] Jquery 1.2.3 does not return a type for radio controls?
Hi All, I'm stuck with Jquery 1.2.3 in a trac-based application. I'm trying to get the type of a form control, to determine what mechanism I should use to set it's value (ie, text controls use .val(), checkboxes get .attr(checked, checked) etc.). When I fetch my list of controls, and loop through them with each, printing the value of .attr('type') on each... the text, checkbox, and textarea types work fine, but radio controls come up undefined. Is this a jquery bug? Does anyone know if/when it was fixed? Maybe I can port that patch back to 1.2.3 to solve my problem. Any other suggestions appreciated. -Scott
[jQuery] Post values to an outside website
Hello all, I have 2 websites which i'm working on. One website has a simple email newsletter page (Site A) and another is a new website i just created with the newsletter sign up form (Site B). I was wondering if it would be possible to send the form from Site B and have it post the data Site A and then display the results in a modal box. Basically I'm wondering if this is allowed or if this is XSS and will be blocked. The other thing is would I use the $.post or the $.load functions to accomplish this. Thank you for your help!! Steve
[jQuery] Re: How to make this work for multiple elements with same class
Ok...made that change, but no difference in the execution. Here's the relevant js and html/cf: $(document).ready(function() { $('.update-link').click(function() { $(this).prev('.options').hide(); $(this).next('.update-div').fadeIn(500); }); }); div class=options [ a href=#tour_url# target=_blankPreview/a ] nbsp; [ a class=update-link href='##'Update/a ] nbsp; [ a href= ##Delete/a ] /div div class=update-div divEdit Link:/div divinput class=textinput01 update-input size=80 value=#tour_url#/div divinput class=update-button type=button value=Update/div div -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: Tuesday, January 13, 2009 3:05 PM To: jQuery (English) Subject: [jQuery] Re: How to make this work for multiple elements with same class to start: you have $('this') it should be without the ticks $(this) On Jan 13, 2:50 pm, Rick Faircloth r...@whitestonemedia.com wrote: Here's the code that I'm trying to make function for multiple links on a page with the class of update-link How would I change this to make it work for the specific .update-link element that I click? $(document).ready(function() { $('.update-link').click(function() { $('this').prev('.options').hide(); $('this').next('.update-div').fadeIn(500); }); }); Thanks, Rick
[jQuery] Re: How to make this work for multiple elements with same class
Rick - I think you want $(this).parent().hide() rather than prev, and $(this).parent().next() rather than next(). Prev and next look at the sibling level. -- Josh -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Rick Faircloth Sent: Tuesday, January 13, 2009 12:17 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: How to make this work for multiple elements with same class Ok...made that change, but no difference in the execution. Here's the relevant js and html/cf: $(document).ready(function() { $('.update-link').click(function() { $(this).prev('.options').hide(); $(this).next('.update-div').fadeIn(500); }); }); div class=options [ a href=#tour_url# target=_blankPreview/a ] nbsp; [ a class=update-link href='##'Update/a ] nbsp; [ a href= ##Delete/a ] /div div class=update-div divEdit Link:/div divinput class=textinput01 update-input size=80 value=#tour_url#/div divinput class=update-button type=button value=Update/div div -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: Tuesday, January 13, 2009 3:05 PM To: jQuery (English) Subject: [jQuery] Re: How to make this work for multiple elements with same class to start: you have $('this') it should be without the ticks $(this) On Jan 13, 2:50 pm, Rick Faircloth r...@whitestonemedia.com wrote: Here's the code that I'm trying to make function for multiple links on a page with the class of update-link How would I change this to make it work for the specific .update-link element that I click? $(document).ready(function() { $('.update-link').click(function() { $('this').prev('.options').hide(); $('this').next('.update-div').fadeIn(500); }); }); Thanks, Rick
[jQuery] split email address into 2 fields; syntax error...
code $(document).ready(function(){ $(#email).change(function () { var email_addy = $('#email').val(); var name_bit = email_addy.(split(@)[0]); $('#username').val() = name_bit; }).change(); }); /code I'm getting an XML error on the split function; can someone help me take this: dave.t...@test.com and split that into 2 pieces: dave.test test.com -- View this message in context: http://www.nabble.com/split-email-address-into-2-fields--syntax-error...-tp21444282s27240p21444282.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: split email address into 2 fields; syntax error...
this not valid syntax var name_bit = email_addy.(split(@)[0]); try var name_bit = email_addy.split(@)[0]; to note, either piece of code would produce undesirable results if the user doesn't enter a @ in the field.. you should check for that as well On Jan 13, 3:52 pm, typenerd chairman...@gmail.com wrote: code $(document).ready(function(){ $(#email).change(function () { var email_addy = $('#email').val(); var name_bit = email_addy.(split(@)[0]); $('#username').val() = name_bit; }).change(); }); /code I'm getting an XML error on the split function; can someone help me take this: dave.t...@test.com and split that into 2 pieces: dave.test test.com -- View this message in context:http://www.nabble.com/split-email-address-into-2-fields--syntax-error... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Code simplification?
Try this if you can't change your html (function($) { $.fn.replaceClass = function(class1, class2){ $(this).removeClass(class1).addClass(class2); } })(jQuery); $('.nav_company').hoverIntent(function() { // toggle display of company sub menu content panel $ ('.nav_sub_default, .nav_sub_products, .nav_sub_markets, .nav_sub_tools_support, .nav_sub_news_events').replaceClass ('onscreen', 'offscreen'); $('.nav_sub_company').replaceClass('offscreen', 'onscreen'); }, function(){ return false; } ); On Jan 13, 8:36 am, r...@lighthouseuk.net r...@50-tuning.com wrote: Hi, I'm new to jQuery and liking what I've seen so far. I'm curious as to whether I can reduce my code, using chaining perhaps? Example... $('.nav_company').hoverIntent(function() { // toggle display of company sub menu content panel $('.nav_sub_default').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_company').removeClass('offscreen').addClass ('onscreen'); $('.nav_sub_products').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_markets').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_tools_support').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_news_events').removeClass('onscreen').addClass ('offscreen'); },function(){ return false; }); Based on the fact that there are 6 menu items (nav_sub_x) - I currently have the above code entered 6 times to add and remove the necessary classes from each of the relevant DIVs on the page. Is there a cleaner way to do this? Many thanks in advance. Cheers, Rob
[jQuery] Re: How to make this work for multiple elements with same class
Thanks, Josh... You were almost perfect. I just needed to add one more .next to the second line: $(this).parent().next().next().fadeIn(500); then it worked. Another question however, is how to keep the page from going back to the top every time the Update link is clicked. I've got two ## as the href because of ColdFusion need to have two. Is that the problem, or is there another solution? a class=update-link href='##'Update/a That's the current code. Suggestions? Thanks, Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Josh Nathanson Sent: Tuesday, January 13, 2009 3:36 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: How to make this work for multiple elements with same class Rick - I think you want $(this).parent().hide() rather than prev, and $(this).parent().next() rather than next(). Prev and next look at the sibling level. -- Josh -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Rick Faircloth Sent: Tuesday, January 13, 2009 12:17 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: How to make this work for multiple elements with same class Ok...made that change, but no difference in the execution. Here's the relevant js and html/cf: $(document).ready(function() { $('.update-link').click(function() { $(this).prev('.options').hide(); $(this).next('.update-div').fadeIn(500); }); }); div class=options [ a href=#tour_url# target=_blankPreview/a ] nbsp; [ a class=update-link href='##'Update/a ] nbsp; [ a href= ##Delete/a ] /div div class=update-div divEdit Link:/div divinput class=textinput01 update-input size=80 value=#tour_url#/div divinput class=update-button type=button value=Update/div div -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: Tuesday, January 13, 2009 3:05 PM To: jQuery (English) Subject: [jQuery] Re: How to make this work for multiple elements with same class to start: you have $('this') it should be without the ticks $(this) On Jan 13, 2:50 pm, Rick Faircloth r...@whitestonemedia.com wrote: Here's the code that I'm trying to make function for multiple links on a page with the class of update-link How would I change this to make it work for the specific .update-link element that I click? $(document).ready(function() { $('.update-link').click(function() { $('this').prev('.options').hide(); $('this').next('.update-div').fadeIn(500); }); }); Thanks, Rick
[jQuery] @name deprecated?
Does this: $('inp...@name=status]').attr($attr_options_01); Need to be this: $('input[name=status]').attr($attr_options_01); With the latest version of jQuery? I was reading somewhere on this group about this type of change? Any other similar changes I should be aware of? Thanks! Micky
[jQuery] Re: split email address into 2 fields; syntax error...
sure enough that did the trick, thanks for the help. I see where I went wrong now. Also the text still updates even without the @ sign, so I lucked out there! -- View this message in context: http://www.nabble.com/split-email-address-into-2-fields--syntax-error...-tp21444282s27240p21444626.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: @name deprecated?
Yes On Jan 13, 1:10 pm, Micky Hulse rgmi...@gmail.com wrote: Does this: $('inp...@name=status]').attr($attr_options_01); Need to be this: $('input[name=status]').attr($attr_options_01); With the latest version of jQuery? I was reading somewhere on this group about this type of change? Any other similar changes I should be aware of? Thanks! Micky
[jQuery] Re: using setTimeout to apply fade-in effect to multiple divs in sequence
That's pretty useful Balazs, for some reason I couldn't get it to worked though. I saved your plugin bit that appears in that link in a file and named it jquery.asynceach.js and linked it to the page. Anyway, I'll play around with it a little more to see where the problem is. Thanks again On Jan 13, 11:37 am, Balazs Endresz balazs.endr...@gmail.com wrote: I've actually made a bit nicer abstraction as a jQuery plugin a while ago, I think it's much more useful for such things, I almost forgot about it:http://jsbin.com/unini/edit This is how your code looks like with it: $(#container :first-child).asyncEach(function(){ $(this).fadeIn('slow'); }, 500); No global variables, can be reused onmultipleelements, you can stop it, add custom easing and there's a `complete` callback function too! On Jan 13, 3:49 pm, legofish pen...@gmail.com wrote: Thank you so much for the reply. I had figured it out but your way is much more elegant. here's what I had done: $(.box).hide(); var currentBox = $(#container :first-child); fadeMyBoxes(currentBox); function fadeMyBoxes(thisbox){ thisbox.fadeIn('slow'); if (thisbox.is(:last-child)){ clearTimeout(t); } else { var t =setTimeout( function(){fadeMyBoxes(thisbox.next());},50); } }; On Jan 10, 10:04 am, Balazs Endresz balazs.endr...@gmail.com wrote: It can be done with setInterval too but doing it recursively withsetTimeoutis a bit better: var i=0, elements=$('.box'), length=elements.length; functionfade(delay){ elements.eq(i++).fadeOut(); if(i=length) setTimeout(arguments.callee, delay); //arguments.callee is a reference to the current function } fade(500); On Jan 10, 3:05 am, legofish pen...@gmail.com wrote: Hi, I have 20 divs all with the class .box on my page. I want to apply the fadeIn() effect to all of them. I dont want them to allfadein at the same time. I want them tofade-in one by one, with a slight time offset. I dont want to use callback functions, because I dont want to wait until thefadeis completely finished on one div before fading the next div. I want thefadeeffect on the next div to start a short time after the effect on the previous one has started. So I think I need to usesetTimeoutand some kind of a recursive method, but I'm not very good with JS so I was hoping someone would find this trivial and could help answer my question. my thanks in advance.
[jQuery] Re: .animate() queue without pause between animations
Here's the function I use to rotate the menu: http://paste.pocoo.org/show/99509/ The icons are located inside divs with ids 'pos_1' through 'pos_5', 'pos_1' being the leftmost icon, and 'pos_5' being the rightmost icon. The all have class 'pos'. The problematic case occurs when the user clicks on 'pos_1' or 'pos_5' and the menu has to be rotated by 2 steps. rotate() is then called twice, and so the call to .animate() is executed twice for each div. I can't use a single call to .animate() because then the divs would jump directly to their final destination instead of passing through adjacent positions. I've tried the following alternatives: 1) Using queue: false and using the second call with setTimeout so that it is executed just before the first animation completes. 2) Using queue: true as in original code but calling .stop() a fraction of a second before the first animation completes on its own so that it is interrupted and the second animation in the queue starts immediately. 3) Putting the second call to .animate() in the callback function of the first animate. All of these alternatives produced exactly the same results as the original code. The rotating menu makes a noticeable pause after the first animation before proceeding with the second. On Tue, Jan 13, 2009 at 8:20 PM, Nikola nik.cod...@gmail.com wrote: It's hard to tell without having a look at the code. You may want to try http://paste.pocoo.org to post code like this. Are you chaining the animations? ie. $(this).animate({},speed).animate ({},speed).animate({},speed); You could always try setting a delay on your second animation with setTimeout. setTimeout ('$(this).animate({},speed)', 400); Hope that helps. Nikola
[jQuery] Re: How to make this work for multiple elements with same class
Instead of href=##, put href=javascript: return false. It will work, but be warned that FF will generate a warning because return is not inside a function. On Tue, Jan 13, 2009 at 10:06 PM, Rick Faircloth r...@whitestonemedia.comwrote: Thanks, Josh... You were almost perfect. I just needed to add one more .next to the second line: $(this).parent().next().next().fadeIn(500); then it worked. Another question however, is how to keep the page from going back to the top every time the Update link is clicked. I've got two ## as the href because of ColdFusion need to have two. Is that the problem, or is there another solution? a class=update-link href='##'Update/a That's the current code. Suggestions? Thanks,
[jQuery] Re: Code simplification?
MorningZ is absolutely right, but if you notice that a certain class is used only by a single element, you should make it an id, which is equally usable by CSS and jQuery. For example, if those lis are part of navigation menu as they seem to be, I would have li class=nav_sub id=default/li li class=nav_sub id=company/li li class=nav_sub id=products/li On Tue, Jan 13, 2009 at 8:31 PM, MorningZ morni...@gmail.com wrote: If you have control on the HTML, it would be a LOT easier/cleaner/make- more-sense if you separate classes for instance li class=nav_sub_default/li li class=nav_sub_company/li li class=nav_sub_products/li to li class=nav_sub default/li li class=nav_sub company/li li class=nav_sub products/li That would make your jQuery life much easier, plus it makes the items actually have common class characteristics Now when you want to manipulate them all: $(li.nav_sub).doSomejQueryAction and yet they all still have their unique styles/characteristics
[jQuery] Re: Jquery 1.2.3 does not return a type for radio controls?
I have no idea if there is a bug like that, but I use this kind of construction to determine if an element is something I need it to be: if ($('#element_id:radio').attr('id')=='element_id') You can use many other : selectors to check if an element is something like an input of a type or visible or animated, etc. I really wish there were some jQuery functions for this. I don't see a better cross-browser way to do this. Just selecting a non-existing element will return an Object just like an existing element. .attr('id') on a non-existing element will return 'undefined' on some browsers and 'null' on others. On Tue, Jan 13, 2009 at 9:15 PM, Scott Sharkey sshar...@linuxunlimited.comwrote: Hi All, I'm stuck with Jquery 1.2.3 in a trac-based application. I'm trying to get the type of a form control, to determine what mechanism I should use to set it's value (ie, text controls use .val(), checkboxes get .attr(checked, checked) etc.). When I fetch my list of controls, and loop through them with each, printing the value of .attr('type') on each... the text, checkbox, and textarea types work fine, but radio controls come up undefined. Is this a jquery bug? Does anyone know if/when it was fixed? Maybe I can port that patch back to 1.2.3 to solve my problem. Any other suggestions appreciated. -Scott
[jQuery] Re: How to make this work for multiple elements with same class
A sneaky way to do it would be to remove the href attribute altogether, and create a css class that makes the link appear to be hyperlinked: a.fake-link { text-decoration: underline; cursor: pointer; color: [your link color here] } Then add that class to your non-href links as desired. -- Josh -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Rick Faircloth Sent: Tuesday, January 13, 2009 1:07 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: How to make this work for multiple elements with same class Thanks, Josh... You were almost perfect. I just needed to add one more .next to the second line: $(this).parent().next().next().fadeIn(500); then it worked. Another question however, is how to keep the page from going back to the top every time the Update link is clicked. I've got two ## as the href because of ColdFusion need to have two. Is that the problem, or is there another solution? a class=update-link href='##'Update/a That's the current code. Suggestions? Thanks, Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Josh Nathanson Sent: Tuesday, January 13, 2009 3:36 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: How to make this work for multiple elements with same class Rick - I think you want $(this).parent().hide() rather than prev, and $(this).parent().next() rather than next(). Prev and next look at the sibling level. -- Josh -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Rick Faircloth Sent: Tuesday, January 13, 2009 12:17 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: How to make this work for multiple elements with same class Ok...made that change, but no difference in the execution. Here's the relevant js and html/cf: $(document).ready(function() { $('.update-link').click(function() { $(this).prev('.options').hide(); $(this).next('.update-div').fadeIn(500); }); }); div class=options [ a href=#tour_url# target=_blankPreview/a ] nbsp; [ a class=update-link href='##'Update/a ] nbsp; [ a href= ##Delete/a ] /div div class=update-div divEdit Link:/div divinput class=textinput01 update-input size=80 value=#tour_url#/div divinput class=update-button type=button value=Update/div div -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: Tuesday, January 13, 2009 3:05 PM To: jQuery (English) Subject: [jQuery] Re: How to make this work for multiple elements with same class to start: you have $('this') it should be without the ticks $(this) On Jan 13, 2:50 pm, Rick Faircloth r...@whitestonemedia.com wrote: Here's the code that I'm trying to make function for multiple links on a page with the class of update-link How would I change this to make it work for the specific .update-link element that I click? $(document).ready(function() { $('.update-link').click(function() { $('this').prev('.options').hide(); $('this').next('.update-div').fadeIn(500); }); }); Thanks, Rick
[jQuery] Re: @name deprecated?
Disappointingly, the @ name thing was the only thing announced on the official announcement of these pre-releases http://blog.jquery.com/2009/01/05/help-test-jquery-13-beta-2/ On Jan 13, 4:15 pm, Kean shenan...@gmail.com wrote: Yes On Jan 13, 1:10 pm, Micky Hulse rgmi...@gmail.com wrote: Does this: $('inp...@name=status]').attr($attr_options_01); Need to be this: $('input[name=status]').attr($attr_options_01); With the latest version of jQuery? I was reading somewhere on this group about this type of change? Any other similar changes I should be aware of? Thanks! Micky
[jQuery] Re: How to make this work for multiple elements with same class
what about a return false; in the js method itself? $(this).parent().next().next().fadeIn(500); return false; hopefully somebody can elaborate, but i'd heard that using the javascript pseudo-protocol isn't really... proper? On Tue, Jan 13, 2009 at 1:35 PM, Miloš Rašić milos.ra...@gmail.com wrote: Instead of href=##, put href=javascript: return false. It will work, but be warned that FF will generate a warning because return is not inside a function. On Tue, Jan 13, 2009 at 10:06 PM, Rick Faircloth r...@whitestonemedia.com wrote: Thanks, Josh... You were almost perfect. I just needed to add one more .next to the second line: $(this).parent().next().next().fadeIn(500); then it worked. Another question however, is how to keep the page from going back to the top every time the Update link is clicked. I've got two ## as the href because of ColdFusion need to have two. Is that the problem, or is there another solution? a class=update-link href='##'Update/a That's the current code. Suggestions? Thanks, -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: .animate() queue without pause between animations
What about doing something similar to what Karl Swedberg did in his animated scrolling example? http://www.learningjquery.com/2007/09/animated-scrolling-with-jquery-12
[jQuery] Re: Cycle Plugin - play/pause button?
Just in case anyone out there finds this post like I did and is still a little lost, here's what I finally figured out after much trial, error, and research (my jQuery knowledge is still limited so there are still a lot of basic methods I don't know). $('#pauseBtn').toggle(function() { $('#headlineContent').cycle('pause'); $(this).attr({ src: images/pause_inactive.gif}); }, function() { $('#headlineContent').cycle('resume', true); $(this).attr({ src: images/pause_slide.gif}); }); Eric Greene wrote: Great thanks alot Here's a couple demos: http://www.malsup.com/jquery/cycle/pause.htmlhttp://www.malsup.com/jquery/cycle/hover.html -- View this message in context: http://www.nabble.com/Cycle-Plugin---play-pause-button--tp18349719s27240p21445539.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Selector Question
Why does this work? $($(button)[0]).bind(click, function(event){return AlertOnClick (this + not + $(button)[0]);}); And why does this DOESN'T? $(button)[0].bind(click, function(event){return AlertOnClick(this + not + $(button)[0]);});
[jQuery] Issue with loading content once using AJAX and display it as a SimpleModal (plugin)
I'm using AJAX to load content into a DIV and display it as a simple modal (using the SimpleModal plugin). In order to limit the requests to the server I would like to only load the content once, but that's when I run into trouble. Let me show you the code and then I will explain what happens. HTML: div id=sidebar a id=settings href=# class=settingsSettings/a a id=options href=# class=testTest/a /div div id=contentDefault Text/div JAVASCRIPT: var isLoaded = false; $(document).ready(function () { // click event handler for 'settings' $('#sidebar a.settings').click(function (e) { if (!isLoaded) { $(#content).load(settings.htm); isLoaded = true; } $(#content).modal(); } // click event handler for 'test' $('#sidebar a.test').click(function (e) { $(#content).modal(); } } function hideModal(){ $.modal.close(); } The first time I click on the link 'Settings' the content from 'settings.htm' is correctly displayed as a simple modal. But each time I click on the link after that it will display the DIV's initial text (Default Text). However, if I remove the following line; $(#content).modal(); from the event handler for the link 'settings' and then use the 'test' link instead it displays correctly each time. I can't find the reason why this wouldn't work in the event handler for 'settings'? By viewing the rendered HTML I can confirm that content of the 'settings.htm' is correctly injected to the content div after the initial click. But I can't figure out what happens after that and how the default text make it back in there. I'm pretty new to jQuery so if anyone can shed some light on this issue I would really appreciate it. Thanks, Martin
[jQuery] Selector Question
I'm fairly new to the framework and I've been messing around a bit. These below confuses me. 1. Why is this snippet not working? Firefox's error console throws an error saying $(button)[0].bind is not a function $(button)[0].bind(click, function(event){alert(this)}); 2. And why does this work? $($(button)[0]).bind(click, function(event){alert(this)});
[jQuery] Removing an Image from slide show
I need to remove the first image from my slide show when i use $ ('#overlay').remove(); the image is removed, but an empty space appears in the slideshow. Is there a removeSlide method or something similar? Peter
[jQuery] Selector help
I'm using a attribute selector and I want to combine the *= with the ! = on href. Is there any way to do this?
[jQuery] Capture a click outside of a specific object?
Hi all, Is there a simple way to capture a click event in a window/document and then determine whether the click was inside an element #foo, or outside of that element? Thanks! -Kim
[jQuery] How can I center the horizontal submenu in the Superfish nav-bar style?
I really would like to use Superfish's horizontal nav-bar style - I especially like the memory feature for the current page, but instead of the submenu entries being left aligned, I would need the submenu being centered around the selected main menu. Is there a way for me to achieve such a feat? I've read someplace else about using text-aligned, but when I tried to apply it to Superfish's CSS, nothing changed. Thanks for any pointers.
[jQuery] how to get page number from tablesorterPager?
I'm using tablesorterPager plugin and got stuck. When the table is large, it breaks up the table and displays the page number at the bottom. For example, 3 of 7. This was done using html input tag. How do I extract the current page number and total number of pages? Instead of using html input tag, I need to extract these two numbers so I can do some further processing using javascript. Thanks. -- View this message in context: http://www.nabble.com/how-to-get-page-number-from-tablesorterPager--tp21442668s27240p21442668.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: How to make this work for multiple elements with same class
Thanks for the reply, Milos… Charlie Griefer suggested using “return false” also, but suggested putting it in the js method, itself. Works perfectly! Thanks for the suggestion. It’s good to know I’ve got two ways to approach this in case one doesn’t work. Rick From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Miloš Rašic Sent: Tuesday, January 13, 2009 4:35 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: How to make this work for multiple elements with same class Instead of href=##, put href=javascript: return false. It will work, but be warned that FF will generate a warning because return is not inside a function. On Tue, Jan 13, 2009 at 10:06 PM, Rick Faircloth r...@whitestonemedia.com wrote: Thanks, Josh... You were almost perfect. I just needed to add one more .next to the second line: $(this).parent().next().next().fadeIn(500); then it worked. Another question however, is how to keep the page from going back to the top every time the Update link is clicked. I've got two ## as the href because of ColdFusion need to have two. Is that the problem, or is there another solution? a class=update-link href='##'Update/a That's the current code. Suggestions? Thanks,
[jQuery] Re: How to make this work for multiple elements with same class
Thanks, Charlie! Perfecto! Rick From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Charlie Griefer Sent: Tuesday, January 13, 2009 4:52 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: How to make this work for multiple elements with same class what about a return false; in the js method itself? $(this).parent().next().next().fadeIn(500); return false; hopefully somebody can elaborate, but i'd heard that using the javascript pseudo-protocol isn't really... proper? On Tue, Jan 13, 2009 at 1:35 PM, Miloš Rašić milos.ra...@gmail.com wrote: Instead of href=##, put href=javascript: return false. It will work, but be warned that FF will generate a warning because return is not inside a function. On Tue, Jan 13, 2009 at 10:06 PM, Rick Faircloth r...@whitestonemedia.com wrote: Thanks, Josh... You were almost perfect. I just needed to add one more .next to the second line: $(this).parent().next().next().fadeIn(500); then it worked. Another question however, is how to keep the page from going back to the top every time the Update link is clicked. I've got two ## as the href because of ColdFusion need to have two. Is that the problem, or is there another solution? a class=update-link href='##'Update/a That's the current code. Suggestions? Thanks, -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: Code simplification?
This way you'll have to repeat it for each element anyway. The important thing is to have access to all of them at once, doesn't matter if by a common class or doing it manually: var $submenus = $ ('.nav_sub_default, .nav_sub_products, .nav_sub_markets, .nav_sub_tools_support, .nav_sub_news_events, .nav_sub_company'); $submenus.hoverIntent(function(){ $submenus.removeClass('onscreen').addClass('offscreen'); $(this).removeClass('offscreen').addClass('onscreen'); }, function(){ return false }); And that's it. If you create a common class you can shorten the first line. Note that it's generally faster to redundantly add and remove a class than to filter the current element to save that operation. - ricardo On Jan 13, 7:06 pm, Kean shenan...@gmail.com wrote: Try this if you can't change your html (function($) { $.fn.replaceClass = function(class1, class2){ $(this).removeClass(class1).addClass(class2); } })(jQuery); $('.nav_company').hoverIntent(function() { // toggle display of company sub menu content panel $ ('.nav_sub_default, .nav_sub_products, .nav_sub_markets, .nav_sub_tools_support, .nav_sub_news_events').replaceClass ('onscreen', 'offscreen'); $('.nav_sub_company').replaceClass('offscreen', 'onscreen'); }, function(){ return false; } ); On Jan 13, 8:36 am, r...@lighthouseuk.net r...@50-tuning.com wrote: Hi, I'm new to jQuery and liking what I've seen so far. I'm curious as to whether I can reduce my code, using chaining perhaps? Example... $('.nav_company').hoverIntent(function() { // toggle display of company sub menu content panel $('.nav_sub_default').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_company').removeClass('offscreen').addClass ('onscreen'); $('.nav_sub_products').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_markets').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_tools_support').removeClass('onscreen').addClass ('offscreen'); $('.nav_sub_news_events').removeClass('onscreen').addClass ('offscreen'); },function(){ return false; }); Based on the fact that there are 6 menu items (nav_sub_x) - I currently have the above code entered 6 times to add and remove the necessary classes from each of the relevant DIVs on the page. Is there a cleaner way to do this? Many thanks in advance. Cheers, Rob
[jQuery] Re: How to make this work for multiple elements with same class
It's a mess. It's best to return false from the function or use e.preventDefault(): $(document).ready(function() { $('.update-link').click(function(e) { $(this).parent().hide() .next().next().fadeIn(500); e.preventDefault(); //same effect as 'return false' }); }); cheers, - ricardo On Jan 13, 7:51 pm, Charlie Griefer charlie.grie...@gmail.com wrote: what about a return false; in the js method itself? $(this).parent().next().next().fadeIn(500); return false; hopefully somebody can elaborate, but i'd heard that using the javascript pseudo-protocol isn't really... proper? On Tue, Jan 13, 2009 at 1:35 PM, Miloš Rašić milos.ra...@gmail.com wrote: Instead of href=##, put href=javascript: return false. It will work, but be warned that FF will generate a warning because return is not inside a function. On Tue, Jan 13, 2009 at 10:06 PM, Rick Faircloth r...@whitestonemedia.com wrote: Thanks, Josh... You were almost perfect. I just needed to add one more .next to the second line: $(this).parent().next().next().fadeIn(500); then it worked. Another question however, is how to keep the page from going back to the top every time the Update link is clicked. I've got two ## as the href because of ColdFusion need to have two. Is that the problem, or is there another solution? a class=update-link href='##'Update/a That's the current code. Suggestions? Thanks, -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: @name deprecated?
Why disappointingly? This and the event bubbling were mentioned because these are changes very likely to cause problems. Everything else should remain compatible. But I do understand your complaint for the lack of comment on other changes, as for the live() method. Anyway the release is just behind the corner and they say all docs will be released with it. cheers, - ricardo On Jan 13, 7:49 pm, MorningZ morni...@gmail.com wrote: Disappointingly, the @ name thing was the only thing announced on the official announcement of these pre-releases http://blog.jquery.com/2009/01/05/help-test-jquery-13-beta-2/ On Jan 13, 4:15 pm, Kean shenan...@gmail.com wrote: Yes On Jan 13, 1:10 pm, Micky Hulse rgmi...@gmail.com wrote: Does this: $('inp...@name=status]').attr($attr_options_01); Need to be this: $('input[name=status]').attr($attr_options_01); With the latest version of jQuery? I was reading somewhere on this group about this type of change? Any other similar changes I should be aware of? Thanks! Micky