[jQuery] Full-screen Mode?
Is there some way to switch the browser into full screen mode? Essentially emulating the F11 key in IE would be what I'm trying to accomplish. TIA!
[jQuery] Re: Full-screen Mode?
i think it's generally better to let users configure their own browsers ;) I agree. This would be in response to something the user clicks indicating they want a full-screen view temporarily. Getting rid of all the browser toolbars, menus, etc. Maybe just a way to have a button that triggers the F11? I'd like to remain in the same window, but maybe the window.open is perhaps a backup solution if I can't find a better one. Thanks for the help, I appreciate it! On Sep 26, 12:14 pm, ryan.j ryan.joyce...@googlemail.com wrote: you used to be able to use an activex control to simulate an F11 keypress in IE, but i honestly don't know if it still works. it's likely to trigger a yellowbar prompt in IE these days anyway. you can open a new window without any toolbar, statusbar etc with plain old window.open (http://www.w3schools.com/HTMLDOM/met_win_open.asp), if you just want to force-maximise the window regularly you could try something like... self.moveTo(0,0); self.resizeTo(screen.availWidth,screen.availHeight); but personally i hate sites that do that. Or you could jsut have the text best viewed fullscreen. press F11 for fullscreen or whatever if the window res is below a certain value. i think it's generally better to let users configure their own browsers ;) On Sep 26, 7:35 pm, jhm jmay...@gmail.com wrote: Is there some way to switch the browser into full screen mode? Essentially emulating the F11 key in IE would be what I'm trying to accomplish. TIA!
[jQuery] Re: Full-screen Mode?
And how do we make certain what keyCode 122 actually does? You make a good point. I'd bet, however, for 99% of our users it would work. So maybe it would be worth the risk to provide the functionality for the majority. I'd love to find a better way though, do you have any suggestions? It is an important usability issue for our users. Thanks! On Sep 26, 1:30 pm, Bertilo Wennergren berti...@gmail.com wrote: ryan.j wrote: Maybe just a way to have a button that triggers the F11? you could change the event.keyCode of another keypress if (e.keyCode==13) { e.keyCode=122; return e.keyCode; } And how do we make certain what keyCode 122 actually does? Such things are configurable. It could mean quit the browser or go to the home page or nothing. -- Bertilo Wennergren http://bertilow.com
[jQuery] event coordination problem
Hi- In a form, I'm trying to validate a field when they move off it. But this causes a problem when the field has the focus and they click a button to process the form. In this case, only the field's blur event (or change event) gets fired and nothing for the button click event. Seems like a reasonable thing to want to do, so I figure I'm missing something in they way I've coded this. Any suggestions? Here's the very simple code that exhibits the behavior: head script type=text/javascript src=./js/jquery.js/script script type=text/javascript $(document).ready( function() { $('#id1').blur( function() { alert('blur in id1'); }); $('#id2').click( function() { alert('click in id2'); }); }); /script /head body /body input type=text value=Sample Text name=id1 id=id1 / input type=button name=Finish value=Finish id=id2 / /html
[jQuery] Re: $(this).css({color : red})
The code on that page doesn't match the code in your file. Yours is missing the curly brackets: $(p.blue).css(color : red); should be $(p.blue).css({color : red}); Any syntax error like that will stop the script dead. On Sep 12, 9:58 am, Matthew Rolph marine.ro...@gmail.com wrote: http://testingspot.hostcell.net/sandbox/tests/css.jquery.test.html it somehow doesn't work at all not even the css does it matter where the style and scripts are in the of the document On 9/12/09, Mike Alsup mal...@gmail.com wrote: see that code in the subj.? i'm using FF 3.5, and no matter what i do, .css won't work!! any help? Maybe this isn't what you think it is. Can you post some code or a link?
[jQuery] Re: event coordination problem
Not sure how this helps, and in fact I'm pretty much already doing that. The problem is that if the focus is in the field, when the button is clicked I get the blur event only and not the click event on the button. If you try the code in the OP, you'll see this happening. Remember to click into the text box before clicking on the button. I need the click event for sure. I could live without the blur event in this situation, but I'd also like to understand the dynamics of what is happening for the future. Jim On Sep 12, 10:39 am, Rick Faircloth r...@whitestonemedia.com wrote: How about setting the field to invalid to start with and force the user to blur the field for a validation routine to declare it valid. Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of jhm Sent: Saturday, September 12, 2009 1:04 PM To: jQuery (English) Subject: [jQuery] event coordination problem Hi- In a form, I'm trying to validate a field when they move off it. But this causes a problem when the field has the focus and they click a button to process the form. In this case, only the field's blur event (or change event) gets fired and nothing for the button click event. Seems like a reasonable thing to want to do, so I figure I'm missing something in they way I've coded this. Any suggestions? Here's the very simple code that exhibits the behavior: head script type=text/javascript src=./js/jquery.js/script script type=text/javascript $(document).ready( function() { $('#id1').blur( function() { alert('blur in id1'); }); $('#id2').click( function() { alert('click in id2'); }); }); /script /head body /body input type=text value=Sample Text name=id1 id=id1 / input type=button name=Finish value=Finish id=id2 / /html
[jQuery] Re: Problems with blur/focus when validating a field
I came to the same conclusion once I got it working, and found a better way to alert the user. But, there are other occasions where I need to set the focus from within a similar callback where it is useful. So I'm still happy we discussed it. Thanks! On Sep 9, 10:33 pm, Mr Speaker mrspea...@gmail.com wrote: I think they don't let you hold focus for a reason... I've tried it on a couple of my forms and it's annoying! I wanna leave it blank and come back to it damn it! ;) On Sep 10, 2:27 pm, Mr Speaker mrspea...@gmail.com wrote: It's like tabbing to the next field is NOT the default action - but something more intrinsic/unrelated. So even if you cancel the default action, it doesn't stop the tab? weird. I was also thinking that it would be a good idea to plugin-erise this functionality, so if there's a better way to do it then you could just update the plugin! Like: $.fn.require = function(){ return this.each( function(){ $( this ).blur( function(){ if( ! $( this ).val().match(/\S/) ){ alert( 'invalid' ); var _this = this; setTimeout( function(){ $( _this ).focus() }, 0 ); } }) }); }; Then just call it like $('input.required').require(); and any inputs with the required class would have the validator. On Sep 10, 2:02 pm, jhm jmay...@gmail.com wrote: Thanks! I knew about the validate stuff, it was kind of a quick and dirty example. But I appreciate your bringing it all to my attention. The jQuery docs for blus() say the default action can be prevented by returning false. Maybe it should be corrected. Your suggestion of using setTimeout produces the desired results. Like you said, not too pretty but effective. Thanks! On Sep 9, 7:40 pm, Mr Speaker mrspea...@gmail.com wrote: I think the problem is that according to the W3C standards, the blur event is not cancelable: They don't seem to want the programmer to be able to mess with a blur... But also, your validation code is a bit buggy anyway: the ret variable is undefined and the regex you use will only catch the cases where someone pastes in a tab or carriage return value - not if it's an empty field. Also also, I think if you call focus inside blur they sort of fight for control of the cursor! It seems to work if you put a slight delay on the event, like: function validateFld( fld ){ return fld.match(/\S/); } $( '#fld' ).blur( function(){ if ( !validateFld( $( this ).val() ) ){ alert( 'invalid' ); setTimeout( function(){ $( '#fld' ).focus() }, 0 ); } }); Not particularly attractive, but it works... I'm not sure if there's a nicer way to do it. On Sep 10, 9:49 am, jhm jmay...@gmail.com wrote: I'm having trouble setting the input focus when validating fields in a form. I have a very simple case below, that validates a field for white space. If it has white space, it triggers an alert and I'd like the focus to stay in that field. However, when tabbing, it moves to the next field regardless. I'm using the blur event to validate the field. I'm returning false when it has white space. I've even tried forcing the issue by setting the focus to the field, and that doesn't work either. I must be misunderstanding something. Anyone able to set me straight? TIA code section head script type=text/javascript src=js/jquery.js/script script type=text/javascript $(document).ready( function() { function validateFld( fld ) { var checkWhite = new RegExp(/[\r\n\t ]/); return( !checkWhite.test(fld) ); } $('#fld').blur( function() { if ( !validateFld($(this).val()) ) { alert('invalid field'); ret = false; // $(this).focus(); } return( ret ); }); }); /script /head body div h2Field Test/h2 input type=text name=fld value= id=fld /br / input type=text name=fld2 value= id=fld2 /br / /div /body /html code section
[jQuery] Problems with blur/focus when validating a field
I'm having trouble setting the input focus when validating fields in a form. I have a very simple case below, that validates a field for white space. If it has white space, it triggers an alert and I'd like the focus to stay in that field. However, when tabbing, it moves to the next field regardless. I'm using the blur event to validate the field. I'm returning false when it has white space. I've even tried forcing the issue by setting the focus to the field, and that doesn't work either. I must be misunderstanding something. Anyone able to set me straight? TIA code section head script type=text/javascript src=js/jquery.js/script script type=text/javascript $(document).ready( function() { function validateFld( fld ) { var checkWhite = new RegExp(/[\r\n\t ]/); return( !checkWhite.test(fld) ); } $('#fld').blur( function() { if ( !validateFld($(this).val()) ) { alert('invalid field'); ret = false; // $(this).focus(); } return( ret ); }); }); /script /head body div h2Field Test/h2 input type=text name=fld value= id=fld /br / input type=text name=fld2 value= id=fld2 /br / /div /body /html code section
[jQuery] Re: Problems with blur/focus when validating a field
Thanks! I knew about the validate stuff, it was kind of a quick and dirty example. But I appreciate your bringing it all to my attention. The jQuery docs for blus() say the default action can be prevented by returning false. Maybe it should be corrected. Your suggestion of using setTimeout produces the desired results. Like you said, not too pretty but effective. Thanks! On Sep 9, 7:40 pm, Mr Speaker mrspea...@gmail.com wrote: I think the problem is that according to the W3C standards, the blur event is not cancelable: They don't seem to want the programmer to be able to mess with a blur... But also, your validation code is a bit buggy anyway: the ret variable is undefined and the regex you use will only catch the cases where someone pastes in a tab or carriage return value - not if it's an empty field. Also also, I think if you call focus inside blur they sort of fight for control of the cursor! It seems to work if you put a slight delay on the event, like: function validateFld( fld ){ return fld.match(/\S/); } $( '#fld' ).blur( function(){ if ( !validateFld( $( this ).val() ) ){ alert( 'invalid' ); setTimeout( function(){ $( '#fld' ).focus() }, 0 ); } }); Not particularly attractive, but it works... I'm not sure if there's a nicer way to do it. On Sep 10, 9:49 am, jhm jmay...@gmail.com wrote: I'm having trouble setting the input focus when validating fields in a form. I have a very simple case below, that validates a field for white space. If it has white space, it triggers an alert and I'd like the focus to stay in that field. However, when tabbing, it moves to the next field regardless. I'm using the blur event to validate the field. I'm returning false when it has white space. I've even tried forcing the issue by setting the focus to the field, and that doesn't work either. I must be misunderstanding something. Anyone able to set me straight? TIA code section head script type=text/javascript src=js/jquery.js/script script type=text/javascript $(document).ready( function() { function validateFld( fld ) { var checkWhite = new RegExp(/[\r\n\t ]/); return( !checkWhite.test(fld) ); } $('#fld').blur( function() { if ( !validateFld($(this).val()) ) { alert('invalid field'); ret = false; // $(this).focus(); } return( ret ); }); }); /script /head body div h2Field Test/h2 input type=text name=fld value= id=fld /br / input type=text name=fld2 value= id=fld2 /br / /div /body /html code section
[jQuery] Sending data to the server
Is there a way in jQuery to send data to a server as something other than a command string? It would be very convenient, for example, to send a block of xml or json much like getJSON() in reverse. It would need to be sent over a secure https connection. TIA!
[jQuery] dump html
I'm pretty new to jquery and love it! I was wondering if there was an easy way to dump the html that gets generated after the page gets loaded to verify it's what I wanted and expected (I'd like to check out the source, not just the results). Thanks!
[jQuery] Re: dump html
Thanks! I do use Firebug, but never look at the html tab. That was just what I was looking for! On Aug 26, 8:20 am, MorningZ morni...@gmail.com wrote: Use a tool like Firebug or Web Developer Toolbar to see what's going on On Aug 26, 11:03 am, jhm jmay...@gmail.com wrote: I'm pretty new to jquery and love it! I was wondering if there was an easy way to dump the html that gets generated after the page gets loaded to verify it's what I wanted and expected (I'd like to check out the source, not just the results). Thanks!
[jQuery] Re: .get() failing
Thank you. That explains it very well, and kind of what I expected. On Jun 26, 12:13 pm, Zbyszek Matuszewski zbyszek.matuszew...@gmail.com wrote: Hi! Try to debug your application with Firebug extension for Firefox. You should probably get uncaught exception: Access to restricted URI denied error when trying to access URL that is on other server than the one script is working on (if it's not local file). If that is the case it's security issue - you should receive files from the same server as the script works from. Accessing other server is cross site reference and AJAX doesn't allow cross site references. There can be at least 3 solutions: - you may use wrong address of actual site (for example scripts starts from some.server.com when there iswww.some.server.comdomain), so you should repair this (use relative URLs or make your server side generate actual domain and put into script or make your client side javascript get domain name from the actual URI) - you may use some other server, so to do that you should write server side code (for example with use of sockets in PHP) that will connect, get XML and send it to your script (will work as a proxy, so the AJAX call will be within same domain) - you may try to make an IFRAME dynamically (hidden one) that will load the data and then take the data from that IFRAME (very unclean solution, but it should work, there are some well known scripts that use similar approach to make an AJAX file uploader). On 26 Cze, 20:19,jhmjmay...@gmail.com wrote: I posted this late last night, but got no responses. I thought maybe it scrolled off before anyone had a chance to see it, so I'm posting again. Sorry if this is bad form, I'm new to these groups... I'm having an issue with the $.get() method. When I request a file local to my site (with a relative path), everything works fine. When I request the same file with a full URL, the $.get() isn't successful. I don't know if its a security issue (requesting data from a 3rd party site) or maybe a timing issue, or maybe something else. Here's the essence of the call when it fails: $.get('http://files.myurl.com/myxml.xml', function (data) { alert('got it'); } If I call it with just the 'myxml.xml' as the path, it works fine. Thanks!
[jQuery] Re: ajax get issue
By the way, I've tried this both with a static url, as shown in my example, and a url with a response string (which I eventually will need). Neither worked. Hopefully someone can shed some light on what I'm doing wrong. Thanks! On Jun 25, 8:43 pm, jhm jmay...@gmail.com wrote: I'm having an issue with the $.get() method. When I request a file local to my site (with a relative path), everything works fine. When I request the same file with a full URL, the $.get() isn't successful. I don't know if its a security issue (requesting data from a 3rd party site) or maybe a timing issue, or maybe something else. Here's the essence of the call when it fails: $.get('http://files.myurl.com/myxml.xml', function(data) { alert('got it'); } If I call it with just the 'myxml.xml' as the path, it works fine. Thanks!
[jQuery] .get() failing
I posted this late last night, but got no responses. I thought maybe it scrolled off before anyone had a chance to see it, so I'm posting again. Sorry if this is bad form, I'm new to these groups... I'm having an issue with the $.get() method. When I request a file local to my site (with a relative path), everything works fine. When I request the same file with a full URL, the $.get() isn't successful. I don't know if its a security issue (requesting data from a 3rd party site) or maybe a timing issue, or maybe something else. Here's the essence of the call when it fails: $.get('http://files.myurl.com/myxml.xml', function (data) { alert('got it'); } If I call it with just the 'myxml.xml' as the path, it works fine. Thanks!
[jQuery] Re: Autocomplete - trouble with getJSON callback function not executing?
The link to your json file didn't work, so I couldn't look it over. But incorrectly formatted json will result in a failure in getJSON() call and your callback would never be executed. Your json has to be perfect, so look it over very carefully. Here's a couple of common gotchas: [ { date: 1-Jun, time: 2:00 PM, }, { date: 3-Jun, time: 2:00 PM, }, ] 1) Note that the time field on both records has a comma at the end. This is incorrect, the last field should have no comma at the end. 2) Same thing on the last record, there is a comma following the ending curly bracket. No comma should come after the last record. This file should fail if you try it, but will succeed when removing these commas. There are other formatting errors not quite as common. Basically, json files have to be perfect. A lot of people have json generators to ensure they will be correct. hth!
[jQuery] browser window size change event?
Does jquery have an event defined for when the user changes the size of his browser window? I couldn't find one, but sometimes I don't see the forest for the trees. Thanks!
[jQuery] Re: browser window size change event?
Not sure how I missed, but thank you very much! On Jun 25, 5:09 pm, James james.gp@gmail.com wrote: http://docs.jquery.com/Events/resize On Jun 25, 1:32 pm, jhm jmay...@gmail.com wrote: Does jquery have an event defined for when the user changes the size of his browser window? I couldn't find one, but sometimes I don't see the forest for the trees. Thanks!
[jQuery] ajax get issue
I'm having an issue with the $.get() method. When I request a file local to my site (with a relative path), everything works fine. When I request the same file with a full URL, the $.get() isn't successful. I don't know if its a security issue (requesting data from a 3rd party site) or maybe a timing issue, or maybe something else. Here's the essence of the call when it fails: $.get('http://files.myurl.com/myxml.xml', function(data) { alert('got it'); } If I call it with just the 'myxml.xml' as the path, it works fine. Thanks!
[jQuery] Weird Problem with Default Web Page in Some Browsers
Hi all, I've got a frustrating problem I can't figure out, and thought someone here might be able to help. Seems so simple that I must be doing something wrong, but not sure what to do about it... When I load my site with just the URL and depend on the default page getting loaded (i.e. www.mysite.com), the page shows fine but my events don't seem to get registered. When I specify the default page explicitly (i.e. www.mysite.com/index.html), all is good. Here's how I'm registering the events: $(document).ready( function() { $('body').click( function(event) { if ( $(event.target).is('#myevent') ) { setEvent(); } }); }); But it only happens in FireFox and IE pre-IE8. In Chrome, Opera, Safari, and IE8 it just works. Any ideas how to fix it?
[jQuery] Re: Weird Problem with Default Web Page in Some Browsers
Turns out it was a bug in my code that killed the script from running any further, which occurred before I registered any events. I knew it had to be my fault! I guess some browsers javascript processors are just a little more tolerant of faults than others. Thanks for your help! Jim
[jQuery] Annoying IE Flash
I get an annoying flash in IE when I go to a page. I'm wondering if there is a good way around it. It's my 2nd 3rd level navigation. I have a collapsing menu that is intended to only show the 3rd level nav once its corresponding 2nd level is selected. In case javascript is turned off, I have them all visible in my markup, and then hide them on page load. In IE, it shows the expanded menu first then hides them, thus the annoying flash. Here's the code: $(document).ready( function() { $('.nav3').hide(); $('.nav2 li a').removeClass('selected'); $('.nav2 li a:first').addClass('selected'); }); Here's the markup: div class=nav2 ul li a href=#Menu One/a /li li a href=#Menu Two/a ul class=nav3 lia href=#One/a/li lia class=last href=#Two/a/li /ul /li li a href=#Menu Three/a /li li a href=#Menu Four/a ul class=nav3 lia href=#One/a/li lia class=last href=#Two/a/li /ul /li li a href=#Menu Five/a /li /ul /div Anyone see how I could do this better and eliminate the flash? Thanks!
[jQuery] Re: Annoying IE Flash
Try giving this a read:http://www.learningjquery.com/2008/10/1-awesome-way-to-avoid-the-not-... Great post, thank you!
[jQuery] Re: .load() and timing
The callback function (that in this case is the second parameter in the load function) gets called once snippet has actually returned. That was it. Should have known better, but I really appreciate the input. Thanks!
[jQuery] .load() and timing
I'm new to jquery and so far it's awesome. I've run into a problem, however, that I don't fully understand how to deal with. (sorry for the cross post, if it is one, I accidentally posted this originally in the UI group). I'm using .load() to load a snippet of HTML in response to a click. I need to modify the HTML, based on what was clicked. Even though I do the modifications after the snippet is loaded, the modifications seem to operate on the initial HTML instead of the freshly loaded code. I figure there is a timing issue I'm missing, but I also figure this must be possible. Any advice? Thanks!
[jQuery] Re: .load() and timing
You'll probably need to supply a snippet of the relevant bit of your code. It could be a number of things. Is this enough? function addActivity(activity, name, id) { // load activity snippet $(#activity).load('activity.html'); // populate fields in a form $('#ModName').val(name); $('#ModID').val(id); } Make sure you're doing the modifications to the loaded HTML (which will be located in the element you've chosen) in the callback function. Maybe this is where I'm going wrong. I'm trying to modify specific ids in the document (which I assumed now includes the freshly loaded code). Thanks!
[jQuery] jquery, ajax, and search engines
I've noticed when I fill in dynamic content on a page using jquery that when you view source you don't see the dynamic content. So I'm wondering if search engines don't see it as well. It's obviously a serious consideration. Thanks!
[jQuery] Re: IE Problem
Are you sure you understand what Fiddler does? Yea, I saw what it does and I really appreciate the tip. It's really useful and I could see the actual GET was working returning the data. The problem was with the json data in the file I was opening (a fundamental mistake on my part). Just in case anyone is interested, here's the problem with IE: var myjson = { 'tag1': 'entry1, 'tag2: 'entry2',// -- that comma will cause an error in IE, but not FF or Opera }; Our data is actually automatically formatted, but we mistakenly thought the comma was allowed on the last entry. Apparently it's dependent on browser implementation. But thanks very much for your help!
[jQuery] Re: IE Problem
Fiddler is a great tool, thanks for that tip! Unfortunately, it doesn't help my problem. I figure I must be doing something fundamentally wrong, since jquery is widely thought of as browser agnostic. So, I put together a small sample file that has everything in it (and still exhibits the problem). If anyone can see something I'm doing wrong, please point it out. Here's the html file: === !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; xml:lang=en lang=en head !-- saved from url=(0019)http://www.mvd.com/ -- meta http-equiv=content-type content=text/html; charset=utf-8/ titlejquery problem/title script src=./scripts/jquery.js type=text/javascript/script script type=text/javascript !-- $(document).ready(function() { $.getjson('./files/v-winter.txt', function(data){ $('tbody.schedule').empty(); $.each(data, function(eindex, entry) { if (eindex == 1) { alert( entry['day'] + '-' + entry['date'] ); } }); }); }); -- /script /head body table tbody class=schedule trtdrow one/td/tr trtdrow two/td/tr trtdrow three/td/tr /tbody /table /body /html ===
[jQuery] Re: IE Problem
I'd suggest downloading and installing Fiddler (http://www.fiddlertool.com) That's a great tool, thanks! Unfortunately, it doesn't help my problem. I figure I must be doing something fundamentally wrong, since jquery is widely thought of as browser agnostic. So, I put together a small sample file that has everything in it (and still exhibits the problem). If anyone can see something I'm doing wrong, please point it out. Here's the html file: === head meta http-equiv=content-type content=text/html; charset=utf-8/ titlejquery problem/title script src=./scripts/jquery.js type=text/javascript/script script type=text/javascript !-- $(document).ready(function() { $.getjson('./files/v-winter.txt', function(data){ $('tbody.schedule').empty(); $.each(data, function(eindex, entry) { if (eindex == 1) { alert( entry['day'] + '-' + entry['date'] ); } }); }); }); -- /script /head body table tbody class=schedule trtdrow one/td/tr trtdrow two/td/tr trtdrow three/td/tr /tbody /table /body ===
[jQuery] IE Problem
The following code works in Firefox and Opera, but does nothing in IE. The problem is the loading of the json file. Am I missing something? $(document).ready(function() { alert('two'); $.getJSON('./files/v-winter.json', function(data){ alert('three'); $('tbody.schedule').empty(); }); });
[jQuery] parsing xml
I'm new to jquery and I'm trying to do a simple xml parse. When I use the .each() to get the tags, if there is more than one tag in the file, nothing more in the script gets processed. In the code below, you'll see two alerts. If I comment out the .each() line I get both alerts. If I leave it in, only the first appears and I never see any alerts from the .each() statement. Can anyone tell me what's wrong? Here's the 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; xml:lang=en lang=en head script src=./scripts/jquery.js type=text/javascript/script script type=text/javascript $(document).ready(function() { $('.button').click(function() { $.get('data.xml', function(data) { $('#container').empty(); alert('one'); var html = $(data); $('#container').append(html); $(data).find('item').each(function(i) { alert(i); }); alert('two'); }, 'xml'); }); }); /script /head body div class=buttonLoad/div div id=container psome placeholder text/p /div /body - Here's the contents of data.xml: - item sample one /item item sample two /item - Remove the second item and it works with the .each() left in. Thanks!
[jQuery] Re: parsing xml
jQuery needs a context for find() to work. That worked thanks! The xml file I was really using actually had a context similar. But it also had a header that was causing the problem. It was: ?xml version=1.0 encoding=UTF-8? Any idea why this would break it? Thanks!
[jQuery] Browser compatibility
I'm new to jQuery and have a simple script to set up an object in the markup. It works fine on FireFox and Opera, but fails to do anything in IE7. Are there steps I'm missing to make it work on all three? Here's the code in its simplest form: head script type=text/javascript src=js/jquery.js/script script type=text/javascript $(document).ready(function() { var objectID = myID; classID = myClassID; srcUrl= http://www.myurl.com/;; codeBase = srcUrl+download/mytest.exe; appID = myAppID; appInit = AppInitString; $(object).attr(id, objectID); $(object).attr(classid, classID); $(object).attr(codebase, codeBase); $([EMAIL PROTECTED]).attr(value, appID); $([EMAIL PROTECTED]).attr(value, srcUrl); $([EMAIL PROTECTED]).attr(value, appInit); $(object).each(function(i) { alert( this.getAttribute(id) ); alert( this.getAttribute(classid) ); alert( this.getAttribute(codebase) ); }); $(param).each(function(i) { alert( this.getAttribute(value) ); }); }); /script /head body object width='900' height='600' id='' classid='' codebase='' param name='AppID' value='' / param name='SrcURL' value='' / param name='AppInit' value='' / /object /body Thanks!
[jQuery] Re: Browser compatibility
I like all your suggestions, but none seemed to help. Two things to note: 1) When I run the code in my OP (with your changes), it works fine in FF and Opera, but IE doesn't even seem to recognize it at all. It does nothing, no alerts nothing. Almost like javascript was disabled (which it isn't, I checked, see below). Is there something wrong with my code/ markup? 2) When I run the code in my real web page, it does run in IE but not perfectly. All the param settings works fine. The Object settings work for the codebase attribute, but the other two (id, classid) don't get set (they are blank in my alert and the object won't work properly). Any other ideas or thoughts? Like I said, I'm new to jquery (and love what I've seen so far) but this if frustrating! Thanks!