[jQuery] Jquery Ajax vs base Ajax approach
Hi, Jquery is gr8 I agreed. But when I am working on a registration page then this jquery is not providing me seamless effect. There is two select box - drop down 1 State 2 City when ever a user select a state correspondingly city comes in city drop down. I used two apprach for this 1 Ajax- Jquery $.ajax({ type: POST, url: ?php //echo $html-url('/users/city') ?, data: state_id= + escape(state_value), success: function(html){ $(#id_city).html(html); } 2 Base Ajax approach Create a HTTP object : httpObject Open http connection httpObject.open(GET, url, true); httpObject.send(null); httpObject.onreadystatechange = setOutput; getting response on httpObject.readyState == 4 Base Ajax approach return me better results then jquery. But I need seemless - more better results... Can somebody tell me how should I get more better results for this? Should I follow jquery instead of Base AJAX approach? Thanks
[jQuery] Re: event.preventDefault() seems to fail
instead of using preventDefault for the input, submit buttons use it for the form.submit event. That means write a event handler for onsubmit event of form and in that handler use preventDefault. It will work. We also had a same requirement. It solves the problem. On Sat, Oct 18, 2008 at 9:14 AM, Hullah [EMAIL PROTECTED] wrote: Hmm...it looks like triggerHandler() is what I want. Because my goal is to not submit the form, which was the reason I was calling event.preventDefault() inside the click event. I just thought it was confusing because in the click even of the button I was trying to prevent the default action of submitting the form by calling preventDefault, yet the form was still submitting. Thanks for pointing out triggerHandler. On Oct 17, 8:24 pm, Choan Gálvez [EMAIL PROTECTED] wrote: While I don't fully understand what you want to do, I suspect that what you need is the `triggerHandler` method. See http://docs.jquery.com/Events/triggerHandler . Or... submit the form instead of clicking the button.
[jQuery] Need Help with Serializing Ajax Calls
I am using AjaxManager and I modified the JSuggest Plugin and set the option to abortOld so that it aborts all old requests. However, the older requests are not aborted. The fragment of the code for declaration $(function() { var ajaxManager1 = $.manageAjax({manageType: 'abortOld', maxReq: 0}); The modified fragment is as below.(jSuggest) ajaxManager1.add({ url: opts.url, async: false, mode: 'abort', type: opts.type, data: realdata, success: function(msg){ $ (jC).find('ul').remove(); $ (jC).append(msg); $ (#jSuggestContainer ul li).bind(mouseover, function(){ $(jH).removeClass(jsH); $(this).addClass(jsH);... Any Other Help that can be done so as to serailize the calls or abort old uncompleted calls will be welcome
[jQuery] Equal height containers with expand abilities
Hello, I am trying to find a way to do the following. I have included some code (link below) of the basic layout for the question at hand showing two examples of content amount possible. The Goal: When someone lands on the page there are 3 containers in a row. All three containers are of equal height regardless of the amount of content in them. If there is more content then can fit in the given height of a container, a “…more…” link is added. When the “…more…” link is clicked on, the container expands to display the full content. The “…more…” link only displays when needed. The three containers always start out with a set height, say 400px, regardless of what the amount of content might be. So every time a person lands on this page the three containers always have the start height of 400px. In other words it is not to behave like an “equal height” based on the largest of the containers. To summarize: - minimum height at all times (all containers are at least 400px tall at all times) - a start height of 400px for all containers regardless of content amount - if the content amount is more than the start height (overflow?) then a “…more…” link is added to the bottom of the container. Clicking on this link expands the container to show the full content. - At this point the containers behave independent of each other. In other words, expanding one container has no affect of the others. - A bonus feature would be to have a “…close…” link to shrink the container back to the starting height (minimum height) after it has been expanded. Some sample code as a starting point. http://paste.pocoo.org/show/88358/ Thank you in advance.
[jQuery] Re: IE6 only 'partially' updating html loaded via ajax
$.ajaxSetup({cache: false}); Maybe the cache results
[jQuery] Showing 1 post after being buried.
Hello. jquery newbie here. I'm trying to build a digg-like bury- comment feature with drupal. I got the comments to bury after a certain number of negative votes, but i don't know how to create a *show button that shows only 1 post (after it's been already buried). Anything like this: $(p).click(function () { Would affect all hidden posts right? How would I go about it so that jquery selectively targets 1 post like digg does. Thanks!
[jQuery] Jquery hide and fadeout are not the same
I have these two lines of code: $(#imagestrip ul li a img).hide(); $(#imagestrip ul li a img).fadeOut(1); While Hide not only hides the img element it also hides the li element. fadeOut only hides the img element. Is this a bug or a feature? I want to be able to hide only the img element but I want the hiding to be instant, not a fade. -- View this message in context: http://www.nabble.com/Jquery-hide-and-fadeout-are-not-the-same-tp20043754s27240p20043754.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Jquery Ajax vs base Ajax approach
Can you elaborate on what you mean by seemless? Like mainly, what is the issue? And what is better results? the results should be the same if your php code is any code On Oct 18, 2:27 am, bookme [EMAIL PROTECTED] wrote: Hi, Jquery is gr8 I agreed. But when I am working on a registration page then this jquery is not providing me seamless effect. There is two select box - drop down 1 State 2 City when ever a user select a state correspondingly city comes in city drop down. I used two apprach for this 1 Ajax- Jquery $.ajax({ type: POST, url: ?php //echo $html-url('/users/city') ?, data: state_id= + escape(state_value), success: function(html){ $(#id_city).html(html); } 2 Base Ajax approach Create a HTTP object : httpObject Open http connection httpObject.open(GET, url, true); httpObject.send(null); httpObject.onreadystatechange = setOutput; getting response on httpObject.readyState == 4 Base Ajax approach return me better results then jquery. But I need seemless - more better results... Can somebody tell me how should I get more better results for this? Should I follow jquery instead of Base AJAX approach? Thanks
[jQuery] Give rest to Mouse Buttons...........
Hi all, I got one problem when i am trying to write click free code. I am using onmouseover effect every time to give focus to HTML Elements. But i am facing two problems here 1. I am not able to execute my code in Internet Explorer. It is executing in mozilla. 2. I am not able to display drop down list of select object. For this i am triggering click event when mouseover event is fired. can any body solve this issue please. Here is my Code: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head script language=javascript type=text/javascript src=C:/mozillaie/pi.js/script script language=javascript type=text/javascript src=C:/mozillaie/firebug-lite.js/script script src=http://code.jquery.com/jquery-latest.js;/script meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 / titleUntitled Document/title /head script language=JavaScript1.4 $(document).ready(function(){ $(select).mouseover(function(){this.click();}); $(*).mouseover(function(){this.focus();}); $([EMAIL PROTECTED]'radio']).mouseover(function(){$(this).attr(checked, ($(this).is(:checked))?:checked);}); $([EMAIL PROTECTED]'checkbox']).mouseover(function(){$ (this).attr(checked,($(this).is(:checked))?:checked);}); }); /script !-- $(input).mouseover(function(){this.focus();});$ (radio).mouseover(function(){this.change();}); -- body pfieldset legend align=centerJQuery Funda/legend div align=center p input type=text name=textfield / input type=text name=textfield2 / input type=text name=textfield3 / input type=text name=textfield4 / /p pnbsp;/p pnbsp;/p table width=200 border=1 tr tdinput type=checkbox name=checkbox value=checkbox // td tdnbsp;/td tdlabel input name=radiobutton type=radio value=radiobutton / /label/td tdnbsp;/td /tr tr tdinput type=checkbox name=checkbox2 value=checkbox // td tdnbsp;/td tdinput name=radiobutton type=radio value=radiobutton / /td tdnbsp;/td /tr tr tdinput type=checkbox name=checkbox22 value=checkbox / /td tdnbsp;/td tdinput name=radiobutton type=radio value=radiobutton / /td tdnbsp;/td /tr tr tdinput type=checkbox name=checkbox23 value=checkbox / /td tdnbsp;/td tdinput name=radiobutton type=radio value=radiobutton / /td tdnbsp;/td /tr /table pnbsp; /p select size=1 style=width:125px optionArjuna/option optionPhalguna/option optionPartha/option optionKeereeti/option /select pnbsp; /p textarea rows=4 cols=80I am free from Click/textarea /div /fieldset/p pnbsp;/p pnbsp;/p /body /html
[jQuery] Check to make sure checkbox is checked using validator
My code: p span class=requiredDo you agree to the terms above? br/span labelinput type=radio class=radioButton name=emp_termsAgreed value=YesYes/label labelinput type=radio class=radioButton name=emp_termsAgreed value=NoNo/label /p I want to require that the checkbox with the value of Yes is checked before the form will submit. How is this done?
[jQuery] Re: strange bytes marker at head of jquery.blockUI.js?
On Fri, Oct 17, 2008 at 7:39 PM, Mike Alsup [EMAIL PROTECTED] wrote: not too sure if anybody noticed this (I did a cursory search through the archives - but didnt find anything), but what is with those first 3 non-ascii bytes at the head of the js? (0xef, 0xbb, 0xbf) Are they supposed to mean or do anything? They arent present in the old version, btw (http://jqueryjs.googlecode.com/svn/trunk/plugins/blockUI/jquery.block...) - I am led to think that they are there somehow as an accident of editting, or something... If i could get a confirmation here (one doubts whether these characters have any functionality role to play as part of the js), that would be great. Definitely an accident. In what version do you see this? in the current version? 2.09. And 2.08 as well (which I have a copy of). -jf
[jQuery] Re: JQuery Selector and Java Script Variable
I met a similar issue, but i can determine it happens only with Firefox (3.0.3). The variable selector seems to be the problem. I explained the whole thing here:http://jsbin.com/aciwi in short, $([id=' + variableId + ']).text( variableValue ); won't always work with FF (it works in first steps) but document.getElementById( variableId ).value = variableValue; will always work I can't succes in making my code working with jsbin (i tried several ways to) because the code use ajax with xml and I can't make the relation between them. You can view the jquery code here: http://jsbin.com/aciwi That should load a sample xml here : http://jsbin.com/ebupo But it does not Anyway, i posted the same code here at my own ftp: jquery/html page: http://rotinpain.ifrance.com/tests/test4xml.html xml data source: http://rotinpain.ifrance.com/tests/test4xml.xml Let me know if you see something that i didn't. i'm fairly new to jquery but i think the code is ok.
[jQuery] Slide one div off left, expand another in one click?
I have a page to code where there will be two divs side by side. The left one will contain navigation, and a button. Clicking this should slide the dive off the page to the left, leaving just a button. At the same time, the right-hand div should expand to fill the space left. Clicking the button should reverse the process. Google Maps is a good example of what I'm looking for. Q1: Is this something I can do with jQuery? Q2: If so, can anyone point me in the right direction or even offer code examples? Thanks!
[jQuery] Superfish - Fix to allow custom easing
I wanted an easeOutBack easing for my animation. It was easy with a few modifications: modify sf.defaults sf.defaults = { etc current defaults, easing : 'swing' }; modify showSuperfishUl (the 2nd to last line) from $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); }); return this; to $ul.animate(o.animation,o.speed,o.easing,function() { sf.IE7fix.call($ul); o.onShow.call($ul); }); return this; Swing is a native function in jquery, so I have that set to default. If you include the easing plugin, then you have all of those animations. easeOutBack looks really nice. The example call would then be: $j('ul#main-menu') .superfish({ animation: {opacity:'show',height:'show'}, easing: 'easeOutBack' }) });
[jQuery] [Superfish] Close current after delay
Hi I've a new layout with Superfish (horizontal + 2 vertical sub): http://www.metadelic.com/upload/brassam/layout_brassam/ Everthing is perfect. Exept that I wish close after a short delay the current path and display only the active menu (horizontal in red). How I can do that? Thx in advance for your help and time. Regards, Dom
[jQuery] xml parsing useing jquery not working in IE7
below example is working in FF but not working in IE. Pls somebody help me. //xml file ?xml version=1.0 encoding=ISO-8859-1 ? Incentives incentive incentiveID=288061 name=FWD 4dr I4 notes=Gas I4 2.3L/ incentive incentiveID=288062 name=FWD 4dr I4 notes=Gas I4 2.3L/ /Incentives //js file // File: readXML.js // Start function when DOM has completely loaded $(document).ready(function(){ // Open the students.xml file $.get(incentives.xml,{},function(xml){ // Build an HTML string myHTMLOutput = ''; myHTMLOutput += 'table width=98% border=1 cellpadding=0 cellspacing=0'; myHTMLOutput += 'thincentiveID/ththname/ththnotes/th'; // Run the function for each student tag in the XML file $(xml).find('Incentive').each(function(){ var $Incentive = $(this); var incentiveID = $Incentive.attr(incentiveID); var name = $Incentive.attr(name); var notes = $Incentive.attr(notes); // Build row HTML data and store in string mydata = BuildStudentHTML(incentiveID,name,notes); myHTMLOutput = myHTMLOutput + mydata; }); myHTMLOutput += '/table'; // Update the DIV called Content Area with the HTML string alert(mydata); $(#ContentArea).append(myHTMLOutput); }); }); function BuildStudentHTML(incentiveID,name,notes){ // Check to see if their is a post attribute in the name field // Build HTML string and return output = ''; output += 'tr'; output += 'td'+ incentiveID + '/td'; output += 'td'+ name +'/td'; output += 'td'+ notes +'/td'; output += '/tr'; return output; } // JavaScript Document// JavaScript Document // html file html head titleJQuery Easy XML Read Example/title script type=text/javascript src=jquery.js/script script type=text/javascript src=test-incentive.js/script /head body div id=ContentArea/div /body /html
[jQuery] Find element in a iframe
Hello !!! I have a very nice problemen , I would like to keep all the .entry element in a Iframe. (div class=entry. /div) My Iframe is : iframe id=test name=hello width=50% height=500px src=http://radiofrance-blogs.com/fabienne-sintes/ feed/ //iframe I try differents thinks whithout succes. If someone have the solution it wil be my friend for the next 3 years !!! Thank for your help !!! Fabrizio
[jQuery] Slider plugin not working in, at first, hidden div
Hello, For exercice, i have build a custom content slider plugin (which i will share as soon as it is finished). It all works fine so far. See http://preview.hetfabrikaat.nl/fabrikaat/car.htm http://preview.hetfabrikaat.nl/fabrikaat/car.htm for a working in progress example. As i said, all works fine. But please check out http://preview.hetfabrikaat.nl/fabrikaat/test.aspx http://preview.hetfabrikaat.nl/fabrikaat/test.aspx in IE if you please. A hidden div will open automaticly and show my slider plugin. But, in IE, the number controls on the right do not function. How does this happen and what can i do about it? Is this somehow connected to the fact that, initially, the div that contains the slider is hidden? Any help is much appricated. Thank you, Corstiaan (netherlands) -- View this message in context: http://www.nabble.com/Slider-plugin-not-working-in%2C-at-first%2C-hidden-div-tp20033394s27240p20033394.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] trouble with passing parameters to a callback function
This is my code: var ClassName = {}; ClassName.CallBackFunction = function(index,i) { alert($(index).attr('src') + ' ' + i); } function() { for (var i = 0; i img_list.length;i++){ $(new Image()).load(function () { ClassName.CallBackFunction.apply(this,[$(this),i]); }).attr(src,$(img_list[i]).attr(src)); } However when the alert comes up it always shows the same value for i, not the value that was in effect at the time the load function was called. If I change my code to: function() { for (var i = 0; i img_list.length;i++){ $(new Image()).load( ClassName.CallBackFunction.apply(this,[$(this),i]) ).attr(src,$(img_list[i]).attr(src)); } I get the correct value for i but now the $(this) points to the wrong item. How can I have both the $(this) and the value of i passed to the callback function? Or is it a having my cake and eating it too situation? -- View this message in context: http://www.nabble.com/trouble-with-passing-parameters-to-a-callback-function-tp20044360s27240p20044360.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Jquery change event
How do I get jquery's change event you fire per letter typed into a text box? I'm using the code below, but it only fires when I tab off the textbox. Thanks, Ronn html head script type=text/javascript src=jquery.js/script script type=text/ javascript $(document).ready(function() { $('input').change(function() { alert('you changed something'); }); }); /script / head body input type=text / input type=text / input type=text / / body /html
[jQuery] some doubt
1. init $.fn[ready?ready:load] (fn) here if we delete $.fn.ready,it comes $.fn.load(fn) equals to $ (document).bind(load,fn); Does it make any means? 2. selector if my selector is ~.xx or ~ xxx,the search results are the same the reason is : the line 1537: // And remove the token t = jQuery.trim( t.replace( re, ) ); here remove the blank results a bug . i think here we should remove the code above or replace the code with if ( t.indexOf( ) == 0 ) continue;
[jQuery] getting new window to appear at mouse click coordinates
I need to have a window appear at the exact location of the link that I click (so its not floating in the middle of the page or something). Can someone help me out? Thanks. script src=jquery-1.2.6.min.js type=text/javascript/script script src=jqModal.js type=text/javascript/script script src=jqDnR.js type=text/javascript/script script type=text/javascript // this example shows the use of onShow and onHide callbacks. Make // sure to read the documentation for futher instructions, and // an explanation of the hash argument. $().ready(function() { $().mousemove(function(e) { $('#ex3c') .jqDrag('.jqDrag') .jqResize('.jqResize') .jqm({ trigger:'#ex3cTrigger', overlay: 0, onShow: function(h) { /* callback executed when a trigger click. Show notice */ h.w.css('left',e.pageX + 'px'); h.w.css('top',e.pageY + 'px'); h.w.css('opacity',0.92).slideDown(); }, onHide: function(h) { /* callback executed on window hide. Hide notice, overlay. */ h.w.fadeOut(slow,function() { if(h.o) h.o.remove(); }); } }); setTimeout('#ex3c', 1000); }); }); /script a href=# id=ex3cTriggerview/abrbrbr div class=windowLocation div id=ex3c class=jqmNotice div class=jqmnTitle jqDrag h1Did you know?/h1 /div div class=jqmnContent pPine, spruce, or other evergreen wood should never be used in barbecues. These woods, when burning or smoking, can add harmful tar and resins to the food. Only hardwoods should be used for smoking and grilling, such as oak, pecan, hickory, maple, cherry, alder, apple, or mesquite, depending on the type of meat being cooked./p /div img src=close_icon.png alt=close class=jqmClose / img src=resize.gif alt=resize class=jqResize / /div /div
[jQuery] move and resize window according to parent window position
Does anybody have a way to move a popup window so that it is always centered over the parent window. I am having trouble figuring this out. Thanks, Tom
[jQuery] Re: event.preventDefault() seems to fail
I've thought of that, but I'm not sure that would work for me. I only want a sub section of input textboxes and certain input buttons within that sub section to prevent the form submit on the Enter button. So if I did it on the form submit event, I'd need to know who caused the submit and whether or not to cancel it. My sample was simpler that my real world form for the purpose of the question. If it's not as hard as I'm thinking it is, please explain. On Sat, Oct 18, 2008 at 6:08 AM, Prajwala Manchikatla [EMAIL PROTECTED] wrote: instead of using preventDefault for the input, submit buttons use it for the form.submit event. That means write a event handler for onsubmit event of form and in that handler use preventDefault. It will work. We also had a same requirement. It solves the problem.
[jQuery] Re: Jquery tab
Thanks for your time and you support. I got it up and running now. Maybe not the most effecient way but it works. On 17 okt, 16:50, Klaus Hartl [EMAIL PROTECTED] wrote: On 17 Okt., 15:37, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Works amazing. I adjusted the ui.tabs.js file so that i targets to css stuff of my own site. Well, it's usually not the best idea to adjust the file itself (maintenance, e.g. updating gets more work), especially if everything you need is already provided by the plugin. That said, to change the class name for the selected tab - without changing the source - initialize it like so: $('#foo').tabs({ selectedClass: 'your-own-special-name' }); And even that is not really required since you could just adjust the given CSS. Whatever, maybe I got your problem wrong. Last question, i have another menu where i want to add this, but it uses different css styles hoe do i make this si that he uses other styles for that part? I usually do such styling by context. Say one of your tab panes is inside a div with the id one and another one is inside a div with the id 'two'. You can then write your CSS like: #one .your-own-special-name { color: green; } #two .your-own-special-name { color: red; } HTH, --Klaus
[jQuery] Re: JQuery Selector and Java Script Variable
In your case the proplem is that you're using .text() instead of .value() on the textarea. The strangest thing is why does .text() even work unless you change the content? It's quite misleading because it shouldn't work on input elements: http://docs.jquery.com/Attributes/text On Oct 18, 6:09 pm, RotinPain [EMAIL PROTECTED] wrote: I met a similar issue, but i can determine it happens only with Firefox (3.0.3). The variable selector seems to be the problem. I explained the whole thing here:http://jsbin.com/aciwi in short, $([id=' + variableId + ']).text( variableValue ); won't always work with FF (it works in first steps) but document.getElementById( variableId ).value = variableValue; will always work I can't succes in making my code working with jsbin (i tried several ways to) because the code use ajax with xml and I can't make the relation between them. You can view the jquery code here:http://jsbin.com/aciwi That should load a sample xml here :http://jsbin.com/ebupo But it does not Anyway, i posted the same code here at my own ftp: jquery/html page:http://rotinpain.ifrance.com/tests/test4xml.html xml data source:http://rotinpain.ifrance.com/tests/test4xml.xml Let me know if you see something that i didn't. i'm fairly new to jquery but i think the code is ok.
[jQuery] Re: Jquery Ajax vs base Ajax approach
I mean response time using base ajax approach or jquery? Which one is fast ? Please tell me Thanks On Oct 18, 6:52 pm, MorningZ [EMAIL PROTECTED] wrote: Can you elaborate on what you mean by seemless? Like mainly, what is the issue? And what is better results? the results should be the same if your php code is any code On Oct 18, 2:27 am, bookme [EMAIL PROTECTED] wrote: Hi, Jqueryis gr8 I agreed. But when I am working on a registration page then thisjqueryis not providing me seamless effect. There is two select box - drop down 1 State 2 City when ever a user select a state correspondingly city comes in city drop down. I used two apprach for this 1Ajax-Jquery $.ajax({ type: POST, url: ?php //echo $html-url('/users/city') ?, data: state_id= + escape(state_value), success: function(html){ $(#id_city).html(html); } 2BaseAjaxapproach Create a HTTP object : httpObject Open http connection httpObject.open(GET, url, true); httpObject.send(null); httpObject.onreadystatechange = setOutput; getting response on httpObject.readyState == 4 BaseAjaxapproach return me better results thenjquery. But I need seemless - more better results... Can somebody tell me how should I get more better results for this? Should I followjqueryinstead ofBaseAJAXapproach? Thanks
[jQuery] Re: JQuery Selector and Java Script Variable
Slightly aside to your actual problem - I looked at the jsbin dump you did and the source XML (http://jsbin.com/ebupo ) and noticed the XML tags had been escaped - so I've gone in to the database and updated it manually so your test page now works (or works in that it demonstrates the problem). Cheers, Remy (author of JS Bin...which is why I could edit and fix the source for you!)
[jQuery] How to gzip a javascript file | I am not able to find.
Hi All, I am a PHP programmer. I dont have access to the htdocs or apache of my web hosting. *Can we gzip JS and CSS fiels? How to do it ? Can we do it PHP?* I am using windows OS. What i can see in the blogs are they are telling some unix commands to gzip. Is there any other way to do it on Windows Os? Is there any link which says = do these steps to gzip your js files. -- Thanks Regards Sridhar K N [EMAIL PROTECTED]
[jQuery] Re: trouble with passing parameters to a callback function
This is a classic issue, you just have to use another closure: for (var i = 0; i img_list.length;i++) (function(i){ $(new Image()).load(function () { ClassName.CallBackFunction.apply(this,[$(this),i]); }).attr(src,$(img_list[i]).attr(src)); })(i) but it's a bit easier with $.each: $.each( img_list, function(i){ $(new Image()).load(function () { ClassName.CallBackFunction.apply(this,[$(this),i]); }).attr(src,$(img_list[i]).attr(src)); }) A short description about what is really happening: http://www.mennovanslooten.nl/blog/post/62 On Oct 18, 7:46 am, GTakacs1976 [EMAIL PROTECTED] wrote: This is my code: var ClassName = {}; ClassName.CallBackFunction = function(index,i) { alert($(index).attr('src') + ' ' + i); } function() { for (var i = 0; i img_list.length;i++){ $(new Image()).load(function () { ClassName.CallBackFunction.apply(this,[$(this),i]); }).attr(src,$(img_list[i]).attr(src)); } However when the alert comes up it always shows the same value for i, not the value that was in effect at the time the load function was called. If I change my code to: function() { for (var i = 0; i img_list.length;i++){ $(new Image()).load( ClassName.CallBackFunction.apply(this,[$(this),i]) ).attr(src,$(img_list[i]).attr(src)); } I get the correct value for i but now the $(this) points to the wrong item. How can I have both the $(this) and the value of i passed to the callback function? Or is it a having my cake and eating it too situation? -- View this message in context:http://www.nabble.com/trouble-with-passing-parameters-to-a-callback-f... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: JQuery $ function
How does this work...(This actually does what I want it to, but I am amazed that JQuery can figure out how to select from an array) If the incoming arg to $() is an array, it's assumed to be an array of DOM elements. That's what your get_selected_rows() returns, so jQuery creates an object that has those elements. However, it seems like you could do it with a single selector and no function: $(#sortable_table tbody :checkbox:checked).parent().parent().parent().parent().remove(); Instead of doing all those parent calls, you could do this if the parent element to be removed has a class like item: $(#sortable_table tbody :checkbox:checked).parents(.item).remove(); At least I think that should work...give it a try and see.
[jQuery] how to auto-submit a form (when a select box changes) and load the response in the same page in a div
hi all! greetings to everyone! I am sorry if I missed the solution of this problem given here already but I searched for quite some time. here is my problem I have written a form with only a select box which, when changed, should submit its form and load the response from the server in the same page under a specific div/div so that the user doesn't have to navigate away from that page when he wants to change that select box again. So far I am trying with a submit button and when I click on submit after changing the select box, it works. code:: script language='javascript' $(document).ready(function() { var options = { target:'#content', // target element(s) to be updated with server response beforeSubmit: function() { document.body.style.cursor = 'wait'; }, // pre-submit callback success: function() { document.body.style.cursor = 'default'; } // post-submit callback }; // bind to the form's submit event $('form').submit(function() { $(this).ajaxSubmit(options); return false; }); }); /script div id='content' style='border:1px solid black' form id=publicationform id=publicationform action=show.jsp method=POST select name=publication id=pubitemlist .. input type=submit value=Select/ /form how can I make it work without the submit button? (I have tried select name=publication id=pubitemlist onChange=this.form.submit(); which causes it to load a new page what I want is to load the response (page) in the div specified in AJAX fashion! Thanks in advance! Regards,
[jQuery] question about loading javascript into an element after dom is ready
I'd like to load a js file into a specific location but it replaces the page with what is being written out. I suspect there's a fairly obvious answer (maybe it can't be done). Here's a basic version of the code and I would like it to write 'here i am' in the dom after div id='jt'/div. Currently, it replaces the dom. Also if I take it out jquery and place it at the end, it still replaces the page: html head script type='text/javascript' src='/jsource/jquery.min.js'/ script script type='text/javascript' $(document).ready(function(){ alert(I am ready); var pom=document.createElement('script'); var jt=document.getElementById('jt'); pom.setAttribute('type','text/javascript'); pom.setAttribute('src','write.js'); jt.appendChild(pom); }); /script /head body bBefore things started/b to make senese: div id='jt'/div here are other things here /body write.js: document.write('here i am');
[jQuery] Re: strange bytes marker at head of jquery.blockUI.js?
Definitely an accident. In what version do you see this? in the current version? 2.09. And 2.08 as well (which I have a copy of). I don't see any problem with the original file: http://www.malsup.com/jquery/block/jquery.blockUI.js?v2.09 I think it must just be your copy? Mike
[jQuery] Re: How to gzip a javascript file | I am not able to find.
search for mod_deflate on google I use jsMin and cssTidy, others prefer other options 2008/10/18 Sridhar Kuppalli [EMAIL PROTECTED] Hi All, I am a PHP programmer. I dont have access to the htdocs or apache of my web hosting. *Can we gzip JS and CSS fiels? How to do it ? Can we do it PHP?* I am using windows OS. What i can see in the blogs are they are telling some unix commands to gzip. Is there any other way to do it on Windows Os? Is there any link which says = do these steps to gzip your js files. -- Thanks Regards Sridhar K N [EMAIL PROTECTED]
[jQuery] Re: Jquery tab
I have one little question left. Thits is a TAB: lia href=#menu-1 class=topmenuBeginpagina/a/li is't possbile to make the tab also clickable, because the a href is already in use. On 18 okt, 19:59, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks for your time and you support. I got it up and running now. Maybe not the most effecient way but it works. On 17 okt, 16:50, Klaus Hartl [EMAIL PROTECTED] wrote: On 17 Okt., 15:37, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Works amazing. I adjusted the ui.tabs.js file so that i targets to css stuff of my own site. Well, it's usually not the best idea to adjust the file itself (maintenance, e.g. updating gets more work), especially if everything you need is already provided by the plugin. That said, to change the class name for the selected tab - without changing the source - initialize it like so: $('#foo').tabs({ selectedClass: 'your-own-special-name' }); And even that is not really required since you could just adjust the given CSS. Whatever, maybe I got your problem wrong. Last question, i have another menu where i want to add this, but it uses different css styles hoe do i make this si that he uses other styles for that part? I usually do such styling by context. Say one of your tab panes is inside a div with the id one and another one is inside a div with the id 'two'. You can then write your CSS like: #one .your-own-special-name { color: green; } #two .your-own-special-name { color: red; } HTH, --Klaus- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -
[jQuery] problem with my plugin
Hello, I have a problem with my plugin. I have two error messages: invalid object initializer [Break on this error] $(this).startWidth.animate({endwidth},2000) jquery.m...gcolor.js (ligne 15) $(#msg).MsgColor is not a function [Break on this error] endHeight: '+=30%' my code : (function($){ var settings; $.fn.MsgColor= function(callerSettings){ settings = $.extends({ startWidth:0, endwidth:null, startHeight:0, endHeight:null },callerSettings||{}); startWidth = $(this).width(startWidth); endWidth = $(this).width(endWidth); startHeight = $(this).height(startHeight); endHeight = $(this).height(endHeight); settings.anim = $(this).show('slow',function(){ $(this).startWidth.animate({endwidth},2000) .animate({backgroundColor: '#Fbc808', color:'#A71602',opacity:0.8}, {queue:false, duration: 2000}); setTimeout(function(){$(this).stop();},1000); },function(){ $(this).animate({backgroundColor: '#FF', color: '#44'}, 2000) }); } })(jQuery); script type=text/javascript $(document).ready(function() { $('#msg').MsgColor({ startWidth: 0, endwidth: '+=30%', startHeight: 0, endHeight: '+=30%' }); }); /script I do not know what to do is my first plugin :D
[jQuery] Does jquery click() always prevent a click-through to the url?
Is this a good way to let the user know that a slow-loading page is coming? $(#menu a).click(function(e){ $.blockUI({ message: h1Loading.../h1 }); location.href = e.target; }) I'm not very familiar with jquery, but as far as I can tell, the .click() function isn't a pass-through... it seems to stop the click in its tracks. Is this so? Peter __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
[jQuery] How do i use JQuery ?
Im trying to download JQuery but its downloading a .download file ... what should i do ?
[jQuery] Re: How do i use JQuery ?
Im trying to download JQuery but its downloading a .download file ... what should i do ? Try this link: http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js
[jQuery] Re: How to gzip a javascript file | I am not able to find.
Since it sounds like Sridhar is using a Windows server, he might need to use compression in IIS rather than apache's mod_deflate. Here is an article I found via google: http://www.keylimetie.com/Blog/2008/5/20/How-to-enable-HTTP-Compression-on-Windows-Server-2003/ Seems pretty straightforward, though I've never tried it. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 18, 2008, at 4:47 PM, Sam Sherlock wrote: search for mod_deflate on google I use jsMin and cssTidy, others prefer other options 2008/10/18 Sridhar Kuppalli [EMAIL PROTECTED] Hi All, I am a PHP programmer. I dont have access to the htdocs or apache of my web hosting. Can we gzip JS and CSS fiels? How to do it ? Can we do it PHP? I am using windows OS. What i can see in the blogs are they are telling some unix commands to gzip. Is there any other way to do it on Windows Os? Is there any link which says = do these steps to gzip your js files. -- Thanks Regards Sridhar K N [EMAIL PROTECTED]
[jQuery] Dynamic load web pages
Hello everyone. I really hope someone can help me, I think what I need help with is a fairly simple issue, and I have found good stuff on the web, but just cant get exactly what I need. Its really simple, I just want to dynamically load a few divs so my users don't have to load a new page every time they click a button. Its for my portfolio. for example from the home page there is button called Audio/Video Production. On click I want it to update 3 divs. One called media where the videos will play, a div next to it that holds text, that describes the video playing. and the third div (lets call it media buttons) below the original navigation buttons that loads up buttons for more videos. The buttons in this third div would then also dynamically load material into the media div and text div (so all these buttons in the third div called media buttons would need to dynamically load two divs) Does this make sense? Sorry I'm more of designer, but I do understand HTML,and some basic AJAX and PHP. Enough to know what I want and that it can be done, but not quite enough to pull it all together. I found many good sites (http://nodstrum.com/2007/02/27/ajaxcontentload/, http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm) that got me some good help but I just couldn't apply it to my web page. The problem I think is that these site have good solutions, but there written by programmers, and they don't explain very well how to use or implement the code. It might make sense to other programmers, but its a little over this designers head. I'm not a newbie, I went to school for media design, and understand a good portion of what I am reading on these other sites, but if someone can help with the solution, and please explain it to me like I'm a child that would really help. Lots of step by steps instruction if you got the patience. I wanted to include a diagram of my site to better illustrate what I want to do, but I don't see how to attach an image or embed one. If anyone want to help with this and would like that diagram please let me know, and I can email it. Thanks
[jQuery] Re: Jquery tab
I'm sorry, I do not quite understand your problem. Do you perhaps mean that the anchor is in use for the loading on mouseover and you need the tab to do something else if you click on it? --Klaus On 18 Okt., 23:07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have one little question left. Thits is a TAB: lia href=#menu-1 class=topmenuBeginpagina/a/li is't possbile to make the tab also clickable, because the a href is already in use. On 18 okt, 19:59, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks for your time and you support. I got it up and running now. Maybe not the most effecient way but it works. On 17 okt, 16:50, Klaus Hartl [EMAIL PROTECTED] wrote: On 17 Okt., 15:37, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Works amazing. I adjusted the ui.tabs.js file so that i targets to css stuff of my own site. Well, it's usually not the best idea to adjust the file itself (maintenance, e.g. updating gets more work), especially if everything you need is already provided by the plugin. That said, to change the class name for the selected tab - without changing the source - initialize it like so: $('#foo').tabs({ selectedClass: 'your-own-special-name' }); And even that is not really required since you could just adjust the given CSS. Whatever, maybe I got your problem wrong. Last question, i have another menu where i want to add this, but it uses different css styles hoe do i make this si that he uses other styles for that part? I usually do such styling by context. Say one of your tab panes is inside a div with the id one and another one is inside a div with the id 'two'. You can then write your CSS like: #one .your-own-special-name { color: green; } #two .your-own-special-name { color: red; } HTH, --Klaus- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -
[jQuery] Prototype to Jquery
Let me first begin by saying that I am a total noob to jquery/prototype/javascript etc. I am trying to setup a basic mail signup script using one of the examples from the mail chimp website (http://www.mailchimp.com/api/downloads/mcapi-simple-subscribe.zip) which uses prototype however I am already using jquery on my page - I believe it is conflicting. The above code still seems to work when I don't use the prototype library (?) but I still get the following error in the debug - Event.observe is not a function which relates to the following lines of script: // Load Events Listeners Event.observe(window, 'load', init, false); function init(){ Event.observe('signup','submit',storeAddress); } // AJAX call sending sign up info to store-address.php function storeAddress(event) { // Update user interface $('response').innerHTML = 'Adding email address...'; // Prepare query string and send AJAX request var pars = 'ajax=trueemail=' + escape($F('email')); var myAjax = new Ajax.Updater('response', 'inc/store-address.php', {method: 'get', parameters: pars}); Event.stop(event); // Stop form from submitting when JS is enabled } - I understand that Event.observe is a prototype call (?) so I was wondering if there is an equivalent jquery call i can use/replace it with? Or some other way to stop the error. Any information for this noob would be greatly appreciated. Cheers -- View this message in context: http://www.nabble.com/Prototype-to-Jquery-tp20030751s27240p20030751.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: IE6 only 'partially' updating html loaded via ajax
Hi Asfman Thanks for the reply - I did as you suggested- adding the option - in two separate ways - neither fixed the issue (1) function getAjax_final(page_url,page_id) { $.ajaxSetup({cache: false}); $.ajax({ type: GET, etc. (2) $.ajax({ type: GET, cache: false, url: page_url, - strange really since operation (2) - (mentioned above) works fine in IE - seems to have mind of its own - hmm cheers jsw_nz
[jQuery] [validate] Only required when something else is selected?
Say I have a form that has a dropdown for country, state and zip/ postal code Now, if you select United States, both state' and zip/postal code are required, but if you select, Argentina only zip/postal code is required, and if you select vietnam then nothing else is required.
[jQuery] JQuery UI Not Working?
I've used JQuery and many plugins before however I am attemtping to update to the newest versions. I downloaded a theme from ui.jquery.com and then a custom package (UI Core + Tabs + Accordion). I keep getting an error that the .tabs is not a known function however. In addition my Accordion is loading fully expanded. Help! What am I doing wrong? If someone could give me a step by step on how to use Jquery with the JQuery UI and a custom theme that would be greatly appreciated. This is what I am doing currently in my head script type=text/javascript src=common/script/ jquery-1.2.6.min.js/script link rel=stylesheet href=common/style/ui_theme.css type=text/ css media=screen, projection / script src=common/script/jquery-ui-personalized-1.5.2.min type=text/javascript/script script type=text/javascript $(function(){ $('#tabContainer ul').tabs(); $('#accordion').accordion({ header: .ui-accordion-header, clearStyle: true }); }); /script This is in my body: div id=tabContainer ul li class=ui-tabs-nav-itema href=#welcomeFeatured Events/a/ li li class=ui-tabs-nav-itema href=#fffUpcoming Events/a/li li class=ui-tabs-nav-itema href=#bbbMost Viewed Events/a/ li /ul div id=welcome div id=accordion div class=ui-accordion-group h3 class=ui-accordion-headera href=#Test 1/a/h3 div class=ui-accordion-content pLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur./p /div /div div class=ui-accordion-group h3 class=ui-accordion-headera href=#Test 2/a/h3 div class=ui-accordion-content pLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum./p /div /div div class=ui-accordion-group h3 class=ui-accordion-headera href=#Test 3/a/h3 div class=ui-accordion-content pLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum./p /div /div /div /div div id=fff Welcome /div div id=bbb Welcome /div /div
[jQuery] tablesort url sorting issue
Howdy. I have a really simple problem that im generating a column of form items which look like: $Guid = new Guid(); $formname2 = $Guid-toString(); // RESULTS IN HERE echotd form method='post' name=' . $formname . ' action='horseview.php' input type='hidden' name='GUID' value=' . $result['HorseGUID'] . ' javascript: document. . $formname . .submit() . $result['Horse_Name'] . /form /td; Hence i would like to sort the url based on the displaying text and not based on the actual url which at the moment is a GUID. Any help would be awsome cakes! -- View this message in context: http://www.nabble.com/tablesort-url-sorting-issue-tp20025862s27240p20025862.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] window height
can anyone point me to where i can get the window height or viewport height of the current window. the code (below) in the onload event doesn't return anything in IE 6 or Chrome but does work in FF3 i just need the height so i can adjust another element on the page to fit in and leave a footer at the bottom of the page $(document).ready(function(){ // Your code here document.write('hello worldbr'); document.write( $(window).height() ); });
[jQuery] Re: How to gzip a javascript file | I am not able to find.
Nice find Karl!! Works great I finally see the magic 16kb number for the 1.2.6 jQuery library from my server/site On Oct 18, 5:50 pm, Karl Swedberg [EMAIL PROTECTED] wrote: Since it sounds like Sridhar is using a Windows server, he might need to use compression in IIS rather than apache's mod_deflate. Here is an article I found via google: http://www.keylimetie.com/Blog/2008/5/20/How-to-enable-HTTP-Compressi... Seems pretty straightforward, though I've never tried it. --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Oct 18, 2008, at 4:47 PM, Sam Sherlock wrote: search for mod_deflate on google I use jsMin and cssTidy, others prefer other options 2008/10/18 Sridhar Kuppalli [EMAIL PROTECTED] Hi All, I am a PHP programmer. I dont have access to the htdocs or apache of my web hosting. Can we gzip JS and CSS fiels? How to do it ? Can we do it PHP? I am using windows OS. What i can see in the blogs are they are telling some unix commands to gzip. Is there any other way to do it on Windows Os? Is there any link which says = do these steps to gzip your js files. -- Thanks Regards Sridhar K N [EMAIL PROTECTED]
[jQuery] Re: Does jquery click() always prevent a click-through to the url?
All jQuery events are pass throughs in the sense you are talking about. Merely intercepting an event with jQuery does not prevent the normal browser behavior for that event. If you handle a click event, the browser will still take its normal action after your code returns. You can prevent the standard behavior by returning false from your event handler. (There are also a couple of functions you can use for more specific behavior - see the docs for details.) But you're not returning false, are you? So why doesn't the normal link action take place? Well, you're assigning e.target into location.href. What is e.target? It's the a DOM element. Assigning that object into location.href certainly isn't doing any good, and perhaps that error is preventing further action. If you take out that assignment it may possibly work better. Or maybe not. I don't know how blockUI works. If it acts immediately, then it should be fine. If it does anything like a timeout before loading the message, then it will be too late because the page will have already navigated. -Mike From: Peter Barney Is this a good way to let the user know that a slow-loading page is coming? $(#menu a).click(function(e){ $.blockUI({ message: h1Loading.../h1 }); location.href = e.target; }) I'm not very familiar with jquery, but as far as I can tell, the .click() function isn't a pass-through... it seems to stop the click in its tracks. Is this so? Peter
[jQuery] Re: window height
The problem is the document.write. You can't do that in a .ready() or .load() or any time except when the document is first loading. (Some browsers allow it anyway; most don't.) $(window).height() should be valid while the document is loading. If you make your document.write calls directly inline while the page loads - not in the ready function and not in an onload function either - then it should work. Or, if you do anything other than a document.write - it can even be an alert() for testing - that should work inside the ready function. BTW, you don't need to use both onload and document ready. Pick one or the other. If you're in an onload function, the document is definitely ready and there's no need for the extra ready call. -Mike From: jquery-en@googlegroups.com can anyone point me to where i can get the window height or viewport height of the current window. the code (below) in the onload event doesn't return anything in IE 6 or Chrome but does work in FF3 i just need the height so i can adjust another element on the page to fit in and leave a footer at the bottom of the page $(document).ready(function(){ // Your code here document.write('hello worldbr'); document.write( $(window).height() ); });
[jQuery] Re: JQuery Selector and Java Script Variable
At first, the textarea has 'text content' (inside the tags), and it's shown inside. When you click the buttons, it updates this text content. *But*, when you edit it manually, you are updating the textarea's VALUE attribute, not the the text inside. When you have both, the value attribute supersedes the text content. If you inspect the textarea using Firebug you will see that the text content is still being changed, it's just not being shown. Changing the function to use val() instead has it working perfectly. http://jsbin.com/ozoqi - ricardo On Oct 18, 4:10 pm, Balazs Endresz [EMAIL PROTECTED] wrote: In your case the proplem is that you're using .text() instead of .value() on the textarea. The strangest thing is why does .text() even work unless you change the content? It's quite misleading because it shouldn't work on input elements:http://docs.jquery.com/Attributes/text On Oct 18, 6:09 pm, RotinPain [EMAIL PROTECTED] wrote: I met a similar issue, but i can determine it happens only with Firefox (3.0.3). The variable selector seems to be the problem. I explained the whole thing here:http://jsbin.com/aciwi in short, $([id=' + variableId + ']).text( variableValue ); won't always work with FF (it works in first steps) but document.getElementById( variableId ).value = variableValue; will always work I can't succes in making my code working with jsbin (i tried several ways to) because the code use ajax with xml and I can't make the relation between them. You can view the jquery code here:http://jsbin.com/aciwi That should load a sample xml here :http://jsbin.com/ebupo But it does not Anyway, i posted the same code here at my own ftp: jquery/html page:http://rotinpain.ifrance.com/tests/test4xml.html xml data source:http://rotinpain.ifrance.com/tests/test4xml.xml Let me know if you see something that i didn't. i'm fairly new to jquery but i think the code is ok.
[jQuery] Re: Jquery Ajax vs base Ajax approach
The only visible differences are that with jQuery you are using POST instead of GET, and sending some data to the server, what you don't seem to be doing on your 'base' approach. Anyway response times should be the same, the function running time is negligible, it only depends on the server. - ricardo On Oct 18, 4:27 am, bookme [EMAIL PROTECTED] wrote: Hi, Jquery is gr8 I agreed. But when I am working on a registration page then this jquery is not providing me seamless effect. There is two select box - drop down 1 State 2 City when ever a user select a state correspondingly city comes in city drop down. I used two apprach for this 1 Ajax- Jquery $.ajax({ type: POST, url: ?php //echo $html-url('/users/city') ?, data: state_id= + escape(state_value), success: function(html){ $(#id_city).html(html); } 2 Base Ajax approach Create a HTTP object : httpObject Open http connection httpObject.open(GET, url, true); httpObject.send(null); httpObject.onreadystatechange = setOutput; getting response on httpObject.readyState == 4 Base Ajax approach return me better results then jquery. But I need seemless - more better results... Can somebody tell me how should I get more better results for this? Should I follow jquery instead of Base AJAX approach? Thanks
[jQuery] Re: Prototype to Jquery
jQuery shouldn't clash with any other library if you are doing it correctly: http://docs.jquery.com/Using_jQuery_with_Other_Libraries basically, call jQuery.noConflict(); then wrap all your jQuery code inside: jQuery(function($){ //code }); - ricardo On Oct 17, 6:23 pm, simpme [EMAIL PROTECTED] wrote: Let me first begin by saying that I am a total noob to jquery/prototype/javascript etc. I am trying to setup a basic mail signup script using one of the examples from the mail chimp website (http://www.mailchimp.com/api/downloads/mcapi-simple-subscribe.zip) which uses prototype however I am already using jquery on my page - I believe it is conflicting. The above code still seems to work when I don't use the prototype library (?) but I still get the following error in the debug - Event.observe is not a function which relates to the following lines of script: // Load Events Listeners Event.observe(window, 'load', init, false); function init(){ Event.observe('signup','submit',storeAddress); } // AJAX call sending sign up info to store-address.php function storeAddress(event) { // Update user interface $('response').innerHTML = 'Adding email address...'; // Prepare query string and send AJAX request var pars = 'ajax=trueemail=' + escape($F('email')); var myAjax = new Ajax.Updater('response', 'inc/store-address.php', {method: 'get', parameters: pars}); Event.stop(event); // Stop form from submitting when JS is enabled } - I understand that Event.observe is a prototype call (?) so I was wondering if there is an equivalent jquery call i can use/replace it with? Or some other way to stop the error. Any information for this noob would be greatly appreciated. Cheers -- View this message in context:http://www.nabble.com/Prototype-to-Jquery-tp20030751s27240p20030751.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: question about loading javascript into an element after dom is ready
Just to be clearer, you can't use document.write() after the page is already loaded. - ricardo On Oct 18, 3:09 pm, jt [EMAIL PROTECTED] wrote: I'd like to load a js file into a specific location but it replaces the page with what is being written out. I suspect there's a fairly obvious answer (maybe it can't be done). Here's a basic version of the code and I would like it to write 'here i am' in the dom after div id='jt'/div. Currently, it replaces the dom. Also if I take it out jquery and place it at the end, it still replaces the page: html head script type='text/javascript' src='/jsource/jquery.min.js'/ script script type='text/javascript' $(document).ready(function(){ alert(I am ready); var pom=document.createElement('script'); var jt=document.getElementById('jt'); pom.setAttribute('type','text/javascript'); pom.setAttribute('src','write.js'); jt.appendChild(pom); }); /script /head body bBefore things started/b to make senese: div id='jt'/div here are other things here /body write.js: document.write('here i am');
[jQuery] Re: strange bytes marker at head of jquery.blockUI.js?
It's probably the Unicode 'BOM' (byte order marker). It creeps in when you save utf-8 files through Notepad or some other editors. Most HTML editors either show it visually at the beginning of the file allowing you to delete it manually or have an option to remove it ('Remove BOM signature' or something like that in Dreamweaver). - ricardo On Oct 17, 1:13 am, Jeffrey 'jf' Lim [EMAIL PROTECTED] wrote: not too sure if anybody noticed this (I did a cursory search through the archives - but didnt find anything), but what is with those first 3 non-ascii bytes at the head of the js? (0xef, 0xbb, 0xbf) Are they supposed to mean or do anything? They arent present in the old version, btw (http://jqueryjs.googlecode.com/svn/trunk/plugins/blockUI/jquery.block...) - I am led to think that they are there somehow as an accident of editting, or something... If i could get a confirmation here (one doubts whether these characters have any functionality role to play as part of the js), that would be great. thanks, -jf --- In the meantime, here is your PSA: It's so hard to write a graphics driver that open-sourcing it would not help. -- Andrew Fear, Software Product Manager, NVIDIA Corporationhttp://kerneltrap.org/node/7228
[jQuery] Re: strange bytes marker at head of jquery.blockUI.js?
On Sun, Oct 19, 2008 at 3:33 AM, Mike Alsup [EMAIL PROTECTED] wrote: Definitely an accident. In what version do you see this? in the current version? 2.09. And 2.08 as well (which I have a copy of). I don't see any problem with the original file: http://www.malsup.com/jquery/block/jquery.blockUI.js?v2.09 I think it must just be your copy? no. Use a traffic sniffer if you dont believe me. wget it. If you're not seeing it, it's only cos whatever you're using to view it hides it from you. -jf -- In the meantime, here is your PSA: It's so hard to write a graphics driver that open-sourcing it would not help. -- Andrew Fear, Software Product Manager, NVIDIA Corporation http://kerneltrap.org/node/7228
[jQuery] Re: question about loading javascript into an element after dom is ready
You are not really taking advantage of jQuery.. and document.write() calls that are not present on page load will always clear the page. You can simply do: $(document).ready(function(){ //$('#jt').after('script type=text/javascript src=write.js/ script'); //insert the script, but this would clear the page too $('#jt').after('pI am here/p'); // writes 'I am here' right after div id=dt }); read the docs at docs.jquery.com, should make things clearer. hope this helps. - ricardo On Oct 18, 3:09 pm, jt [EMAIL PROTECTED] wrote: I'd like to load a js file into a specific location but it replaces the page with what is being written out. I suspect there's a fairly obvious answer (maybe it can't be done). Here's a basic version of the code and I would like it to write 'here i am' in the dom after div id='jt'/div. Currently, it replaces the dom. Also if I take it out jquery and place it at the end, it still replaces the page: html head script type='text/javascript' src='/jsource/jquery.min.js'/ script script type='text/javascript' $(document).ready(function(){ alert(I am ready); var pom=document.createElement('script'); var jt=document.getElementById('jt'); pom.setAttribute('type','text/javascript'); pom.setAttribute('src','write.js'); jt.appendChild(pom); }); /script /head body bBefore things started/b to make senese: div id='jt'/div here are other things here /body write.js: document.write('here i am');