[jQuery] Re: How can I create an element dynamically using jQuery
If you want to manipulate the DOM you can find it documented here; http://docs.jquery.com/Manipulation As for your question, you could either do the following; $(#foo).after(ptext I want to insert/p); $(#foo).before(ptext I want to insert/p); Or more neatly; var pToInsert = $('p/').append(text I want to insert) $(#foo).after(pToInsert); $(#foo).before(pToInsert); On Jan 8, 8:07 am, kimbaudi kimba...@gmail.com wrote: Hi, I'm sorry if this question has already been asked, but I searched for the term 'create element' on the jQuery Google Groups and didn't find the answer. I basically want to create html dynamically and be able to add it to my webpage. Suppose I have the following html: html body pThis is the first paragraph of my webpage./p pHere is some more stuff/p pand some more/p p id=fooand even more/p pand even more/p /body /html How would I be able to create the html ptext I want to insert/p and append it into the p id=foo tag? I'm hoping the new html DOM structure would look like this: html body pThis is the first paragraph of my webpage./p pHere is some more stuff/p pand some more/p p id=fooand even more/p ptext I want to insert/p pand even more/p /body /html How would I be able to prepend it into the p id=foo tag? I'm hoping the new html DOM structure would look like this: html body pThis is the first paragraph of my webpage./p pHere is some more stuff/p pand some more/p ptext I want to insert/p p id=fooand even more/p pand even more/p /body /html Thanks.
Re: [jQuery] Re: ie8 and title text value
Šime, $('title').html() works fine in both IE8 and FF, fixing my problem. But I don't understand why the difference in behaviour on title: surely if there's only one title element than the innerHTML of the first matched element should be the same as the concatenated innerHTML of all matched elements? But if I try to print $('title').text() in IE8, it prints an empty string. In any case, you fixed my problem for me so thanks a lot! Graham Šime Vidas wrote: The, html() method works in all browsers... text() = returns the concatenated innerHTML properties of all matched elements html() = returns the innerHTML property of the first matched element Generally you don't use text() to retreive the contents of an element... BUT, if you want to write to the innerHTML property, then ... html(blablabla) = sets the innerHTML property to the given string on every matched element text(blablabla) = sets the innerHTML property to the given string on every matched element, AND escapes and
Re: [jQuery] Multifile - help
Thanks ... this will surely help me... On Tue, Dec 29, 2009 at 5:39 PM, brian zijn.digi...@gmail.com wrote: OK, I think I understand now: you need to have separate groups of files, each with their own MultiFile input and, thus, one or more files for each group? In that case, you can check for the existence of elements with class=MultiFile, which is the class name given to the automatically-created file elements. var intVal=2; $(document).ready(function(){ $('#addFileButton').click(function(){addUploadFile();}); /* I've given the form id=the_form */ $('#the_form').submit(function() { alert($('.MultiFile').length); return false; }); }); If you need to have separate totals for each group you should add a class name to the group divs. This also makes it simple to get the count for the number of existing groups when creating a new one. Also, your HTML was incorrect (missing body tags). !DOCTYPE html html dir=ltr lang=en-CA script type=text/javascript src=js/jquery.js/script script type=text/javascript src=js/jquery.MultiFile.js/script script $(document).ready(function(){ $('#addFileButton').click(function() { /* get the number of existing groups */ var group_index = $('.SomeClassName').length + 1; var elStr = 'div class=SomeClassName id=group' + group_index + 'Please specify a file, or a set of files (dynamically):br /' + 'input type=file class=multi name=df' + group_index + ' id=df' + group_index + ' size=40 //div'; /* create elements, append, and initialise as MultiFile */ $(elStr).appendTo('#outerVal'); $('#df' + group_index).MultiFile(); }); $('#the_form').submit(function() { /* run through each group and count the number of MultiFile elements */ $('.SomeClassName').each(function() { /* note the 2nd parameter 'this' which sets the context * as the particular group */ alert(this.id + ': ' + $('.MultiFile', this).length); }); return false; }); }); /script /head body form id=the_form action=doUpload enctype=multipart/form-data method=post div id=outerVal div class=SomeClassName id=group1 Please specify a file, or a set of files:br / input type=file class=multi name=df1 size=40 / /div div class=SomeClassName id=group2 Please specify a file, or a set of files:br / input type=file class=multi name=df2 size=40 / /div /div div input type=submit value=Send / input type=button class=button value=Add File id=addFileButton / /div /form /body /html On Tue, Dec 29, 2009 at 4:33 PM, jayakumar ala alajay...@gmail.com wrote: Brian, I our requirement i need to add this file elements dynamically for each file path. And for each element i need the count of files that are uploaded under that filepath. Hope you understand my question now. Help is apprecited. Thanks Jay On Tue, Dec 29, 2009 at 12:56 PM, brian zijn.digi...@gmail.com wrote: You shouldn't need more than one file element to begin with. The plugin takes care of creating new ones. Or, perhaps I don't understand what it is you're trying to do. On Tue, Dec 29, 2009 at 1:27 PM, jayakumar ala alajay...@gmail.com wrote: Anyone can help me on this.. On Mon, Dec 28, 2009 at 10:39 AM, jayakumar ala alajay...@gmail.com wrote: Hi, I am using Multifile plugin to select the multiple file. I am trying to get the final file count for each browser selection . Any help is appreciated. Here is the sample code i am using html script type=text/javascript src=js/jquery.js/script script type=text/javascript src=js/jquery.MultiFile.js/script script var intVal=2; $(document).ready(function(){ $('#addFileButton').click(function(){addUploadFile();}); }); function addUploadFile() { intVal++; $('div id=addVal'+intVal+'Please specify a file, or a set of files (dynamically):br'+ 'input type=file class=multi name=df'+intVal+' id=df'+intVal+' size=40//div').appendTo('#outerVal'); $('#df'+intVal).MultiFile(); } /script form action=doUpload enctype=multipart/form-data method=post div id=outerVal !--p Type some text (if you like):br input type=text name=textline size=30 /p-- div id=addVal1 Please specify a file, or a set of files:br input type=file class=multi name=df1 size=40 /div div
[jQuery] Tabbed Pane
Hi I've just downloaded the plugin and I'm starting to play around with it. Firstly, on first display, the selected tab is defaulting to 1 rather than 0 as documented. This looks odd with the second tab selected rather than the first. I see this in both 1.8.0 and 1.8.1 Secondly, I'm starting with 11 tabs with lengthy titles and the initial layout starts with three rows. Row 1 looks fine with the tabs left aligned. Row 2 looks like the tabs are being right aligned and Row 3 is left aligned again. Depending on which tab I select, the layout shuffles around with tabs at the start/end of a row moving up or down a row. Is this contollable through the tag or am I going to have to go digging around in the css? Regards
[jQuery] Re: ie8 and title text value
Well, maybe the guys at jQuery optimized the text method only for elements that can appear more than once... I don't know. However, text() should not be used for TITLE anyway, so this bug is not a problem.
[jQuery] Problem with using autocomplete on Firefox - asp.net
Hi, I have a search interface on my site http://www.govforyou.co.uk/Default.aspx that allows users perform multiple kinds of searches. You can try it out by typing in the text box at the top. It basically contains a drop down which has 5 options and a text box next to it where user can type search query and a Go button. Now, the Go button is displayed and should be applied only for the first of the five options. When user has chosen any of the last four options, the search box is attached with jquery autocomplete plugin and when user clicks (or presses ENTER key) on one of the suggestions, the page refreshes to take the user directly to target page. However, this ENTER key binding with suggestions is not working in Firefox. To reproduce the problem: 1) Goto the above URL and select any of the last 4 options from the drop down. 2) Type something in the text box and the auto complete will make sure that suggestions are shown 3) Scroll down the suggestion list using UP and DOWN arrow keys and when one of the suggestions are selected, press ENTER. The above should take the user to a different page. But the Go button takes precedence to the autocomplete callback. How do I make sure that ENTER key is bound to the jquery autocomplete callback and not the Go Button when an autocomplete suggestion is selected? This is occurring only in Firefox. I've tested on version 3.5. The issue does not occur on IE8 or Google Chrome. Thanks in Advance, --venustus
[jQuery] simple testing of selectors returning empty result
In many situations I use jQuery selector and I want to check that result is non empty. To make this simple, I use this code: // jQuery extension to test non-empty select (function($) { $.fn.notempty = function() { if (this.length==0) throw('Empty jQuery selector'); return this; }; })(jQuery); ...and than use it like: $(#someID).notempty().show().someotheroperation(); I use custom error handler for javascript errors: window.onerror = function(desc,page,line,chr) { /* my error reporting */ } ...but uncaught exception does not end in this handler. Is there any way to report file and line where this test failed (I mean file and line with $(#someID).notempty()... from my example) ? Thanks a lot for any hint.
[jQuery] JQuery UI Draggable Thumbnail Filmstrip
As a learning experience (and to get the look I wanted), I hand wrote HTML/CSS/jQuery code for a photo gallery with a thumbnail filmstrip. I started with a few ideas of how to slide the thumbnails underneath the main panel of the gallery, and figured the easiest and smoothest way would be to initiate a draggable() function call on the ul selector or containing div of the list of thumbnails, constraining the motion along the x-axis. This works well, but I have a few problems which I'm not quite sure how to attack. I want to set a left and right bound for how far the filmstrip can be dragged and stop animation (even while mid-drag) once this point has been reached. I know this is possible if the parent div is larger than the draggable element, but the parent div I'm working with is smaller than the draggable element. I'll start with the HTML code for the filmstrip: !-- Thumbnail Filmstrip -- div id=viewing-area div id=thumbnails ul id=thumb-strip liimg src=images/thumb-1.jpg width=130px height=80px //li liimg src=images/thumb-2.jpg width=130px height=80px //li liimg src=images/thumb-3.jpg width=130px height=80px //li liimg src=images/thumb-4.jpg width=130px height=80px //li liimg src=images/thumb-5.jpg width=130px height=80px //li liimg src=images/thumb-6.jpg width=130px height=80px //li liimg src=images/thumb-1.jpg width=130px height=80px //li liimg src=images/thumb-2.jpg width=130px height=80px //li li class=lastimg src=images/thumb-3.jpg width=130px height=80px //li /ul /div /div First, I initialize the thumbnail filmstrip by calculating the width of the strip and setting the width of the parent div (#thumbnails), using the following code: function calculateWidth(){ // Accumulate width of each list item to get total width of filmstrip $(#thumb-strip li).each(function(i){ listWidth += parseInt($(this).width()) + parseInt($(this).css(marginRight)) + parseInt($(this).css(paddingLeft)) + parseInt($(this).css(paddingRight)); }); largestMargin = (viewingArea - listWidth); $(#thumbnails).css(width, listWidth); } The #thumbnails div is a child of a div with the id viewing-area, which is the static width window where the filmstrip is viewable - for this particular case, the viewingArea is 800px and the listWidth is 1238px. I want to ensure that the filmstrip cannot be dragged outside this viewing area, and the variable largestMargin is used to account for the largest amount the filmstrip can be shifted left before the LAST picture is completely viewable in the viewing-area. I have found that it is difficult to stop the filmstrip from dragging past the point where the last thumbnail list item is. I tried to assign a function to the 'drag' event which checks the left CSS property to determine if it has passed this point, but the filmstrip still drags beyond this point. Also, when you release the mouse button after dragging, the thumbnail on which the mouse is over is clicked and loaded in the main panel. If possible, I would like to disable this so you cannot select an image on the start or stop event of dragging. Suggestions anyone? Help is much appreciated, Thanks!
[jQuery] Hello all , this is my first venture with Jquery , I am trying to build a Dropdown menu with Menuselects in the Dropdown please take a look
I in IE 8 and Firefox , Opera , and Safari it works fine but im having problems with IE6 and IE7 for some reason when i mouse over and try to move down the box dissappears ... it is a modified version of Plain Drop Down Menu http://afterofficemiami.com/dropdowntest.html in IE6 and IE7 it doesnt work can someone please help me ??? Thank you very much
[jQuery] JQuery or JBoss RichFaces Which is the best?????
Hi I work for some time with JBoss Richfaces and I like it for several reasons. However now it was requested to study the integration of JBoss Richfaces and JQuery. I saw in the Richfaces demo that's already some kind of integration between the two (Richfaces and JQuery). However, from your point of view until here can the integration go? Can I use for instance components from both? E.g. use a JQuery menu and Richfaces table in the same page? If this is possible how can this be made? Thanks in Advance
[jQuery] Help with async ajax inside a loop.
Hi, I have a block of code which iterates through a list of urls and performs an asynchronous ajax request on each url. The call back function assigns the returned data object to the key of another object. The key is the current item in the list that is being iterated on. The problem: The key is always the last element of the array when the call back function is executed. I think this is happening because of the way closures work in javascript. How can I accomplish building my data object the way I want to? --- // I want to build 'dict' so it looks like this: // dict = { u1 : ..., u2 : , u3: ..., u4: ...}; // The values come from the requests to the server. var base_url = /some/path/; var dict = {}; var urls = [u1, u2, u3, u4] for (var i in urls) { u = urls[i]; $.JSON(base_url + u, function (data, message) { dict[u] = data; }); } -- Thanks, Salman
[jQuery] Re: SimpleModal (probably something really stupid)
Did you look at jQuery UI's dialog plug-in? It's very easy to use: http://jqueryui.com/demos/dialog/#modal-message Salman On Jan 7, 10:57 pm, polarwarp polarw...@gmail.com wrote: I am using the jquery simplemodal code to display a div on a page. I am pretty much calling .modal(); on the div, which has a class on it, and I'm styling up that class - some issues though: 1. How do I add a close button. Have seen that I can add a closeimg style - but I can't get anything with this class to appear. I figure I need to set the closehtml property to something but haven't figured out what. As this is embedded in c# I might have stuffed up my string escaping. string termconditions = @$('# + pnlMemberAgreement.ClientID + ').modal({ closeHTML: ''});; I also tried a href=#Close/a instead of just '' - but either its making no difference or I can't figure out what quotations to use within my c# string. .simplemodal-container a.modalCloseImg { background:url(../App_Themes/Images/Ecommerce/x.png) no-repeat; width:25px; height:29px; display:inline; z-index:3200; position:absolute; top:-14px; right:-18px; cursor:pointer; } 2. Whilst the div is made visible, it sits under my content - its not being overlayed over the top, nor does it have a background colour going on. I grabbed from the sample site: .simplemodal-overlay { background-color:#000; cursor:wait; } .simplemodal-container { height:400px; width:600px; background-color:#fff; border:3px solid #ccc; } Is this an additional option I need to set? 3. The div is not acting like a modal object - I can still click other buttons and stuff on the same page and leave the page! 4. I'm confused with the styling. what do I need to put on my div so that the right styles get applied to it - or should I be doing this in options? ie. I have my tc inside a panel, and I tried putting a css class on that for the container part, but where do I put the overlay - or should I not have to do this. It sort of looks like the basic modal example does what I want it to do.. but I can't figure out what I have missed in my implementation of it :( I pretty much have this in my c# string termconditions = @$('# + pnlMemberAgreement.ClientID + ').modal();; and want to apply some basic stylings so that the frontend guy can take over but it will do what its supposed to Thanks for any assistance!
[jQuery] Jquery UI tabs lockable ?
Hi i was wondering if it would be possible to lock out other tabs so the user is stuck on one ..until a user hits a button. For example an Admin is adding someone to a database- the Admin is on the add user tab but after enacting this add process(by input) they cannot leave this tab until either cancelled or accomplished (both done by a user input button). so again would it be possible to Lock out other mobility to tabs locking on just one?
[jQuery] Can we use jquery for paging and sorting in asp.net 2.0 ?????
Hello All, Using jQuery can we include asp.net 2.0 gridview, paging sorting and in-place editing. Waiting for a favorable response. Thanking you, Jackson C.
[jQuery] My table tags are getting stripped out.
Hi I am using jquery form plugin http://jquery.malsup.com/form/ I am not sure if I am doing something wrong but it seems to be stripping out my tr and td html tags when I send stuff back from the server and I am not sure why. I have an asp.net MVC ContentResult that returns some html code. When looking at the stuff the content result is about to return it looks like this(a small portion of what is being returned) trtd class=OtherMonth DateBox id=c_12272009div class=DateLabel OtherMonthHeader27/div/td Once it returns back to the jquery code it looks like this div class=DateLabel OtherMonthHeader27/div All the tr's and td's are stripped out and this is the case for all everthing I returned. Every single tr and td is removed and I mean every single one. This is what I have for my jquery $('#frm_ImportCalendar').livequery(function() { var options = { dataType: 'html', success: function(response) { alert(response); $('#CalendarBody').children().remove(); $('#CalendarBody').append(response); jAlert(Import Complete); } }; $(this).ajaxForm(options); }); Am I missing something?
[jQuery] :contains nbsp; in IE doesn't seem to work
Hi, I've just recently started to use jQuery, and it has already proven extremely useful for formatting tables (and other things as well!). I get raw html-tables into my page, and my only way of styling them are css and, now, jquery. And it's worked out fine. But now I've run into a problem. Which seems to depend on which browser you use. I'm trying to give the table rows with the last cell containing nbsp;, a specific style by adding a class. In FF/Safari/Chrome it behaves as I expect it. But Internet Explorer gives me no result at all. The code: $(tr td:last-child:contains('\u00a0')).parent().attr ('class','markeme-sub'); And I'm stumped. Is it because of how browsers handle the whitespace, or am I missing something in my jquery? Thankful for any help! Best regards Jonatan
Re: [jQuery] Re: img src replacement
Hi Glen. I'm late to the thread (and this is probably a bit off-topic for this list) but up until the point where you asked for the cross-fade, everything you need can be done with vanilla CSS, no need to involve jquery at all. In the page: a class=available-button href=whatever.php Currently accepting new jobs /a In the CSS: div#availibilty a.available-button { display: block; float: right; width: 169px; height: 222px; border: none; background: url('images/avail.png) top left no-repeat; text-indent: -3000px; } div#availibilty a.available-button:hover { background: url('images/availhover.png) top left no-repeat; } I put up the example above using your images: http://b.ite.me.uk/css_demo.html One advantage to this is that it works in browsers that have javascript turned off, and also that screen readers etc. will still see the link as text (try looking at it in Firefox with styles turned off to get an idea what a screen reader sees). Improved accessibility is always a good thing. Hope this helps, if not for this (CSS can't do you a cross-fade) then maybe other projects, Mark
[jQuery] Getting Div to Show after mouseout
$(a.mSelect).hover( function () { var month = $(this).attr(rel); $(#m + month).fadeIn(); }, function () { var month = $(this).attr(rel); $(#m + month).hide(); } ); I have multiple div's acting as buttons, when you over over them it will show the respected div, but I would like this respected div to stay visible until the user hovers over another div(button). In the code above, as soon as the user mouseout the div hides. Please help, thanks!
[jQuery] (validate) Adding in custom validation
Currently I am adding my custom validation (messages, rules) into jquery.validate.js directly. Anyone know how to adding in own customized validation into another js file and if possible, make the jquery.validate.js UNTOUCH.
[jQuery] looping through form elements.
Hello all, I'm relatively new to JavaScript. I would like to loop through all the elements within a form and grab their values and what type of input they are. So far I came up with: $(':input').each(function(idx, item) { alert(idx); }); The alert is placed there to see if it loops and it works as expected. I'm not sure how to alert the input's value and what type it is. Any help is greatly appreciated. -Thanks, Rich
Re: [jQuery] Can we use jquery for paging and sorting in asp.net 2.0 ?????
take a look at jqGrid http://www.trirand.com/blog/ I rarely use asp these days but i think there is a component available. good luck Jon 2010/1/8 Jackson...!!! jacksoncouti...@gmail.com Hello All, Using jQuery can we include asp.net 2.0 gridview, paging sorting and in-place editing. Waiting for a favorable response. Thanking you, Jackson C.
[jQuery] Re: Go through XML nodes only 1 level deep
I just checked the headers and they seem to be outputting correctly. Date: Fri, 08 Jan 2010 13:47:32 GMT Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-09-24) mod_ssl/2.2.8 OpenSSL/0.9.8g X-Powered-By: PHP/5.2.4-2ubuntu5.6 Content-Length: 454 Keep-Alive: timeout=15, max=98 Connection: Keep-Alive Content-Type: text/xml 200 OK
[jQuery] Re: looping through form elements.
Hey, Maby this will help: $('.input').each(function(){ alert('Value: ' + $(this).val() + ' - Type: ' + $(this).attr ('type')); }); That should do the trick. Just let me know. Greetz, Rick On Jan 7, 11:33 pm, rich dottedq...@gmail.com wrote: Hello all, I'm relatively new to JavaScript. I would like to loop through all the elements within a form and grab their values and what type of input they are. So far I came up with: $(':input').each(function(idx, item) { alert(idx); }); The alert is placed there to see if it loops and it works as expected. I'm not sure how to alert the input's value and what type it is. Any help is greatly appreciated. -Thanks, Rich
[jQuery] Re: Getting Div to Show after mouseout
Hey, I would add another class to the div you want to show. That way you can keep it selected until you go over another div. Like this: $(a.mSelect).hover( function () { $('.selected').each(function(){ $(this).hide(); }); var month = $(this).attr(rel); $(#m + month).addClass('selected'); $(#m + month).fadeIn(); }, function () { var month = $(this).attr(rel); $(#m + month).hide(); } ); On Jan 8, 12:40 am, TheHatchet barry...@gmail.com wrote: $(a.mSelect).hover( function () { var month = $(this).attr(rel); $(#m + month).fadeIn(); }, function () { var month = $(this).attr(rel); $(#m + month).hide(); } ); I have multiple div's acting as buttons, when you over over them it will show the respected div, but I would like this respected div to stay visible until the user hovers over another div(button). In the code above, as soon as the user mouseout the div hides. Please help, thanks!
[jQuery] Object position on mousemove. Failed to set up easing.
Hello there, Obviously I've a problem :) An object's position is updated relatively to mouseposition on mousemove (opposite direction). Works perfectly well, but I failed to set up the code with smooth easing as result. The code works in Actionscript in Flash (of course in proper syntax) but it doesn't work in jQuery syntax and code-elements. Strange is that nearly the same code works in Actionscript and there WITH easing In jQuery, I used css() to position the object, animate() with easing produces a messy animation. Any idea how I could implement an easing to this animation? $().mousemove(function(e){ $(.object).each(function(){ var position = $(this).offset(); var position_x = position.left; position_x = 0; var windowwidth = ($(window).width()/2); var endX = (windowwidth)-(e.pageX); var speed = 5; position_x += (endX-position_x)/speed; $(this).css({'left':position_x}); }); }); My result: a href=http://www.eggger.com/index.php;www.eggger.com/ index.php/a Br, Tobie
[jQuery] Re: Getting Div to Show after mouseout
Hey, I would add another class to the div you want to show. That way you can keep it selected until you go over another div. Like this: $(a.mSelect).hover( function () { $('.selected').each(function(){ $(this).removeClass('selected'); $(this).hide(); }); var month = $(this).attr(rel); $(#m + month).addClass('selected'); $(#m + month).fadeIn(); }, function () { var month = $(this).attr(rel); $(#m + month).hide(); } ); Something like that. Hope this helps. Greetz, Rick On Jan 8, 12:40 am, TheHatchet barry...@gmail.com wrote: - Hide quoted text - - Show quoted text - $(a.mSelect).hover( function () { var month = $(this).attr(rel); $(#m + month).fadeIn(); }, function () { var month = $(this).attr(rel); $(#m + month).hide(); } ); I have multiple div's acting as buttons, when you over over them it will show the respected div, but I would like this respected div to stay visible until the user hovers over another div(button). In the code above, as soon as the user mouseout the div hides. Please help, thanks! ReplyReply to authorForward You must Sign in before you can post messages. To post a message you must first join this group. Please update your nickname on the subscription settings page before posting. You do not have the permission required to post. On Jan 8, 12:40 am, TheHatchet barry...@gmail.com wrote: $(a.mSelect).hover( function () { var month = $(this).attr(rel); $(#m + month).fadeIn(); }, function () { var month = $(this).attr(rel); $(#m + month).hide(); } ); I have multiple div's acting as buttons, when you over over them it will show the respected div, but I would like this respected div to stay visible until the user hovers over another div(button). In the code above, as soon as the user mouseout the div hides. Please help, thanks!
[jQuery] Re: Getting Div to Show after mouseout
Hey, I would add another class to the div you want to show. That way you can keep it selected until you go over another div. Like this: $(a.mSelect).hover( function () { $('.selected').each(function(){ $(this).removeClass('selected'); $(this).hide(); }); var month = $(this).attr(rel); $(#m + month).addClass('selected'); $(#m + month).fadeIn(); }, function () {} ); Something like that. Hope this helps. Greetz, Rick On Jan 8, 12:40 am, TheHatchet barry...@gmail.com wrote: $(a.mSelect).hover( function () { var month = $(this).attr(rel); $(#m + month).fadeIn(); }, function () { var month = $(this).attr(rel); $(#m + month).hide(); } ); I have multiple div's acting as buttons, when you over over them it will show the respected div, but I would like this respected div to stay visible until the user hovers over another div(button). In the code above, as soon as the user mouseout the div hides. Please help, thanks!
[jQuery] Re: img src replacement
Hey Mark! Thanks for taking the time to respond! That is a great way to do it. I am learning jquery so I wanted to see how to do it in jquery. As you can see im having a tough time with it lol. thanks for the feedback though Glen On Jan 7, 9:53 pm, Mark Kelly wastedti...@gmail.com wrote: Hi Glen. I'm late to the thread (and this is probably a bit off-topic for this list) but up until the point where you asked for the cross-fade, everything you need can be done with vanilla CSS, no need to involve jquery at all. In the page: a class=available-button href=whatever.php Currently accepting new jobs /a In the CSS: div#availibilty a.available-button { display: block; float: right; width: 169px; height: 222px; border: none; background: url('images/avail.png) top left no-repeat; text-indent: -3000px; } div#availibilty a.available-button:hover { background: url('images/availhover.png) top left no-repeat; } I put up the example above using your images: http://b.ite.me.uk/css_demo.html One advantage to this is that it works in browsers that have javascript turned off, and also that screen readers etc. will still see the link as text (try looking at it in Firefox with styles turned off to get an idea what a screen reader sees). Improved accessibility is always a good thing. Hope this helps, if not for this (CSS can't do you a cross-fade) then maybe other projects, Mark
[jQuery] Re: Can we use jquery for paging and sorting in asp.net 2.0 ?????
take a look at jqGrid http://www.trirand.com/blog/ jqGrid rocks!!
[jQuery] Re: How to define/access public functions for a plugin?
You could consider modifying your plugin to follow the jQuery UI Widget format. This takes advantage of the widget factory, which provides ways to access the methods and properties in 2 ways: 1) Through the element the plugin is applied to, eg: $(#myElement).smartList(selectedValue) 2) Or by getting an 'instance' of the widget, eg: var myList = $(#myElement).data(smartList); var val = myList.getSelectedValue(); If you don't want to go this route, then you need to return an 'instance object' instead of a jQuery object. This means your plugin is not 'chainable' - ie, it must be the last method called on the object. To return an instance, create an object with pointers to your public properties and methods... return { options: options // property , getSelectedValue: getSelectedValue // method , insetItem: internalMethodName } There are a few ideas to get you started. /Kevin On Jan 4, 5:08 am, mehdi mehdi.mous...@gmail.com wrote: Hi, I've just developed a plugin that mimics the combo box control, albeit it's a special one. That's being defined as follows: (function($) { $.fn.extend({ smartList: function(settings) { //prepare settings, blah blah blah... return this.each(function() { //whatever code goes here... }); } }); })(jQuery); You know, to use this plugin, I could easily write the following JavaScript code: var $myList = $('myElement').smartList(); No problem so far. Now, I need to define and access some functions that's specific to the smartList. say, e.g., getSelectedValue, insertItem, and the like. The problem is that I've got no idea how to address such a thing in JavaScript. i.e., I need to write things like: $myList.getSelectedValue(); $myList.insetItem('foo', 'bar'); But this isn't possible, since the $myList variable is a jQuery object. So I just defined some functions, say, $.smartList.getSelectedValue and the like... but in this approach, I've to pass the jQuery object to this functions as a mandatory parameter and this really sucks. i.e., I need to get the selected value of $myList this way: var value = $.smartList.getSelectedValue($myList); Is there any better approach to address such a thing? Any help would be highly appreciated, TIA, Mehdi
[jQuery] Re: Can we use jquery for paging and sorting in asp.net 2.0 ?????
Jackson as professional programmer who exclusively does .NET, allow me to tell you that getting into jQuery changes *everything* .NET's built in controls and jQuery (or any AJAX library in general minus MS Ajax or whatever they call it nowadays) do not play nicely together... in the case of thinking ASP.NET GridView + jQuery pagination, sorting, etc, it is much better in many ways to think instead: use ASP.NET and SQL Server to do the actual paging/sorting and feed that resultant data into something like jqGrid At this point in my programming career, which just entered year # 10, I barely do anything with asp: controls anymore, ASP.NET is simply the tunnel I use between my client script and the data But this is just my personal experience your mileage may vary On Jan 8, 10:12 am, Mike Alsup mal...@gmail.com wrote: take a look at jqGrid http://www.trirand.com/blog/ jqGrid rocks!!
[jQuery] form.submit not function error jquery form plugin
I'm trying to get an upload popup working with the jQuery form plugin (http://jquery.malsup.com/form/). When I click a link I load a form html from the server and add it to a container div by setting the div's html attribute. I then attach a submit handler to the form so I can call the ajaxSubmit function of the form plugin. $('#' + popup.popupId + ' form').submit(function(event) { event.preventDefault(); var options = { dataType : popup.dataType, success : function (data, textStatus) { popup.successHandler(popup, data, textStatus); } }; $('#' + popup.popupId + ' form').ajaxSubmit(options); }); The ajaxSubmit function however throws a form.submit is not a function error. I've tried debugging in firebug and form is an object so I don't understand why the error. Thanks for your help
[jQuery] Re: Go through XML nodes only 1 level deep
On Jan 7, 7:48 pm, Frank Peterson fictionalper...@gmail.com wrote: Well the xml file is not on my server, but I'll try to shoot them an email and let them know, they should set the headers. Are you sure that you're not running into cross-site scripting issues? Security restrictions will prohibit you from AJAXing content from other servers. One solution is to create a local proxy on your server to pass through the calls. For example, this page will error out: http://scott.sauyet.com/Javascript/Demo/2010-01-08a/ But this one will work: http://scott.sauyet.com/Javascript/Demo/2010-01-08b/ The only difference is in the URL that's called: url: http://ipinfodb.com/ip_query.php?ip=; + $(#ip).val() url: proxy.php?url=http://ipinfodb.com/ip_query.php?ip=; + $ (#ip).val() If you're using PHP, feel free to steal the PHP code (which is quite possibly horrible; I don't know PHP that well): http://scott.sauyet.com/Javascript/Demo/2010/01/08b/proxy.phps This is a very limited proxy, proxying only these requests. -- Scott
Re: [jQuery] :contains nbsp; in IE doesn't seem to work
Do these cells contain *only* the nbsp? If so, you could go at it another way: $('td:last-child').each(function() { if ('' == $(this).text().trim()) { $(this).parent().addClass('markeme-sub'); } }); On Fri, Jan 8, 2010 at 7:41 AM, Jonatan jona...@kig.se wrote: Hi, I've just recently started to use jQuery, and it has already proven extremely useful for formatting tables (and other things as well!). I get raw html-tables into my page, and my only way of styling them are css and, now, jquery. And it's worked out fine. But now I've run into a problem. Which seems to depend on which browser you use. I'm trying to give the table rows with the last cell containing nbsp;, a specific style by adding a class. In FF/Safari/Chrome it behaves as I expect it. But Internet Explorer gives me no result at all. The code: $(tr td:last-child:contains('\u00a0')).parent().attr ('class','markeme-sub'); And I'm stumped. Is it because of how browsers handle the whitespace, or am I missing something in my jquery? Thankful for any help! Best regards Jonatan
Re: [jQuery] My table tags are getting stripped out.
I can't see what might be causing that although you could change these 2 lines: $('#CalendarBody').children().remove(); $('#CalendarBody').append(response); ... to: $('#CalendarBody').html(response); That's if you're not using thead, tfoot, and tbody tags, of course. On Fri, Jan 8, 2010 at 12:16 AM, choboj...@gmail.com choboj...@gmail.com wrote: Hi I am using jquery form plugin http://jquery.malsup.com/form/ I am not sure if I am doing something wrong but it seems to be stripping out my tr and td html tags when I send stuff back from the server and I am not sure why. I have an asp.net MVC ContentResult that returns some html code. When looking at the stuff the content result is about to return it looks like this(a small portion of what is being returned) trtd class=OtherMonth DateBox id=c_12272009div class=DateLabel OtherMonthHeader27/div/td Once it returns back to the jquery code it looks like this div class=DateLabel OtherMonthHeader27/div All the tr's and td's are stripped out and this is the case for all everthing I returned. Every single tr and td is removed and I mean every single one. This is what I have for my jquery $('#frm_ImportCalendar').livequery(function() { var options = { dataType: 'html', success: function(response) { alert(response); $('#CalendarBody').children().remove(); $('#CalendarBody').append(response); jAlert(Import Complete); } }; $(this).ajaxForm(options); }); Am I missing something?
[jQuery] Re: click event is not working
thanx a lot! On Jan 8, 3:07 am, Charlie Griefer charlie.grie...@gmail.com wrote: http://docs.jquery.com/Events/live On Thu, Jan 7, 2010 at 2:01 PM, CreativeMind aftab.pu...@gmail.com wrote: hi, i'm appending a child div in a parent div. parent div has already child div's which have classes ws_c1 and plus. $('div/div').addClass('ws_c1').addClass('plus').appendTo($ ('#'+'parentdiv'+counter)); but when i try to do this $(.ws_c1.plus).click(function() {alert('test');}); It works on other child div's but not on the appended div's. I've also tried with Id's. can you plz help me. regards, -- Charlie Grieferhttp://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] reference dynamically loaded form select
Been trying to find the best answer to a problem a co-worker is having with a form select field that gets loaded via an ajax call into a table cell. He has a form and when the page loads based on the value of another form field he makes an ajax call and loads a complete select statement. the ajax load is fine, but when he makes a select from the new select this it is not recognized and passed with the form submit. How can I get this select field to be recognized by the form? Thanks for any insight. Kevin
[jQuery] Re: looping through form elements.
Rick, Thank you for your response. I was able to figure out $ (this).val() grabbed the value and you explained $(this).attr should do the trick with grabbing what type the input element is. I appreciate your help. I had to change .input to :input since I'm filtering out by the element not by a class named input. -Thanks, Rich On Jan 8, 7:11 am, Rick van Hoeij rickvho...@gmail.com wrote: Hey, Maby this will help: $('.input').each(function(){ alert('Value: ' + $(this).val() + ' - Type: ' + $(this).attr ('type')); }); That should do the trick. Just let me know. Greetz, Rick On Jan 7, 11:33 pm, rich dottedq...@gmail.com wrote: Hello all, I'm relatively new to JavaScript. I would like to loop through all the elements within a form and grab their values and what type of input they are. So far I came up with: $(':input').each(function(idx, item) { alert(idx); }); The alert is placed there to see if it loops and it works as expected. I'm not sure how to alert the input's value and what type it is. Any help is greatly appreciated. -Thanks, Rich
[jQuery] hidden values associated with options of dropdown
Hi, I need the ways to solve the problem. scenario is: I have a dropdown and 4 textboxes, which are filled through a callback function. dropdown has multiple values. on selected index change of dropdown i want to fill the text boxes with associated values. e.g dropdown has list of countries. when i select country, the four textboxes are filled with country's four city names. like if india is selected , then textboxes should have delhi, banglore,mumbai,hyderabad if uk is selected, textboxes be filled with london,bermingham,scotland.manchester. if usa is selected then newyork,washington,pentagon,texas be in four textboxes. what i'm currently doing is: -- in code below i'm appending the new dropdown options retrieved from callback function, and also appending the associated cities in hidden input types. var sourcedropdown = $(e.target).parent().parent().children(:nth- child(7)).children().eq(0); $(sourcedropdown).append($('option/option').val(val).html (sourcename).addClass('selectedval'+val)); var cityval=text[1]; $.each(cityval,function(leftval,rightval){ $(sourcedropdown).append(input type=hidden id=hid+leftval+ value=+rightval+ ); }); bydefault [select country] is added in dropdown with no associated cities, -- $(sourcedropdown).change(function(){ // how can i get cities in textboxes }); generated code of my above code is: select name=source id=source0 option value=-1Select country/option option value=0 england/optioninput type=hidden value=london id=hid1/input type=hidden value=birmingham id=hid2/input type=hidden value=liverpool id=hid3/input type=hidden value=leeds id=hid4/ /select --- this is ok for one country but not ok for more than one country.. any different way to associate cities with countries? thanx
[jQuery] Re: form.submit not function error jquery form plugin
sigh...several hours later I find out it's because the submit button has the id submit :(
Re: [jQuery] Drag and Drop and Remember Position?
Yes, please. Thanks, -w kippi-2 wrote: West The way that I was doing it was to store the HTML into the database. Once I get to work I can get an example if you would like? Thanks Chris Owen Sent from my iPhone On 8 Jan 2010, at 06:52, West415 malik.robin...@gmail.com wrote: bump... West415 wrote: Hi, I have a page where users can drag and sort a set of divs. Each div is like a widget and the code below allows you to move divs around pretty easily. The problem for me is I want to somehow store and retrieve the position each div is in so when the page reloads they appear in the same order or when the user logs out and comes back in, they are in the same order. How can this be done? I have the following code: script type=text/javascript $(function() { $(#sortable).sortable({ revert: true }); }); /script div id=sortable div id=divA Panel A /div div id=divB Panel B /div div id=divC Panel C /div /div Thanks, -West -- View this message in context: http://old.nabble.com/Drag-and-Drop-and-Remember-Position--tp27010297s27240p27072008.html Sent from the jQuery General Discussion mailing list archive at Nabble.com . -- View this message in context: http://old.nabble.com/Drag-and-Drop-and-Remember-Position--tp27010297s27240p27082167.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Re: [jQuery] SUPERFISH - submenus not
site isn't loading jquery , or superfish css and script files. Suggest removing one version of jQuery and only loading one. Check the paths to all these files. If they are avaialbel at the correct path you should be able to open them in a browser. Example: http://www.assured-it.com/modules/mod_superfishmenu/tmpl/js/jquery.js Doesn't exist at this URL assur3 wrote: Joel, Thanks for a great module. Everything seems to work well except I can't get the submenus to "hide" with the Suckerfish effects. All submenus are displayed with no mouseover. I must be doing something terribly stupid because no one else seems to have this problem! Forgive my dumb question, but I've tried various settings, checked out my template.css file, etc. but everything seems kosher. My site is www.assured-it.com. The template I'm using is the new Dominion template from Rockettheme with the Gantry architecture. In case you need administrator, you can use the "brock" login with "susukuu" as the password. Any advice you can give me what I'm doing wrong? Thanks. Brock Hotaling
[jQuery] 2nd Trigger for images hover function
I recently implemented the Image Cross Fade Transition (http:// jqueryfordesigners.com/image-cross-fade-transition/) It works great, and I'm hoping to add to the code to enhance the functionality. Currently, if I hover over the image, it runs the cross fade transition, which I would like to keep. I have another div on the page that I would like to trigger the first instance when hovered over as well. Is there a good way to add this? Here's what I'm using for the first instance: $(document).ready(function () { $('div.tv').hover(function () { //hover in var div = $(' div', this); if (div.is(':animated')) { div.stop().fadeTo(500, 1); } else { div.fadeIn(250); } }, function () { // hover out var div = $(' div', this); if (div.is(':animated')) { div.stop().fadeTo(1000, 0); } else { div.fadeOut(1000); } });
[jQuery] Superfish separator
Hi, Only found superfish today, and man oh man do I love it! It's fantastic, and so customisable. My only problem I am having, is getting a separator to show between the menu items! I have tried editing mod_superfishmenu.php and in the xml file and just can't get it to show up. Tried stuff with the CSS as well, and for love nor money (not that I've tried money) can I get them to show! ANY help would be appreciated, even if someone just told me which file to look in!! Thanks again for the awesome project! Regards, eddybaby
[jQuery] Jquery validation remote problem
Hi, I'm using Jquery.validation to remotly test if an e-mail is already in use, it works fine, but... if i do a remote check, it returns the correct response e.g. some...@abc.com already in use but when i click on the field, and then somewere else the message changes to filename.php already in use. Try is on http://www.red187.nl/milk/ This only happens when i set the return vale to 'false' in th eremote file, when i return a message there is no problem... Can someone help me please?
[jQuery] Superfish - Working locally but not working live
Very confused. Working on a Wordpress site/theme and integrating superfish for the main (pages) navigation. Everything is working on locally (running XAMPP on an XP box), but on the live site, child pages are not appearing as dropdowns. I can see in the source that the children are being written into the page, but they are not visible. Currently staging at: http://mobileepiphany.com.previewdns.com/ - there should be two children beneath ABOUT. Once again, this IS WORKING on my localhost: ABOUT has two children and the menu adds a #187; arrow to indicate that it's a dropdown. Any insight/help/pointers would be greatly appreciated.
[jQuery] Resource interpreted as script but transferred with MIME type text/html - Resolved
I saw this warning in Chrome's console for the first time today while loading a jquery.js file in a new site. I used the same script tag I've always used, but for some reason this page wasn't parsing the javascript file. I finally found the solution, although the warning message seems completely unrelated to me. I thought I'd post it here because I couldn't find anything online that lead to this conclusion. The permissions on the jquery.js file were not allowing the internet user (me) to access the javascript file. That's why Chrome didn't warn me that the file did not exist - it did exist but it wasn't letting anyone access it. I changed the permission on the file and the browser can now parse the file and my functions are working correctly (although the warning message now says it's transferring the script with MIME type text/plain). Just thought I'd share. :)
[jQuery] Jquery Validation on Dropdown list Question
How can I validate this as one hidden field.I have 3 dropbdown list month, day, year and I do not want to validate each separate on so I would like to combine the strings together and validate the hidden field. Pleas and thank you for your help. !-- DOB -- fieldset id=section-dob class=group legendspanBirth date/span/legend !-- Month -- div label for=dob_monthMonth/label select name=month value= id=month onchange=document.getElementById('birthdate').value = document.getElementById('month').value + '/' + document.getElementById('day').value + '/' + document.getElementById('year').value; option selected=selected value= Month/option ?php for($i=1;$i=12;$i++) { echo option . $i . /option; } ? /select /div !-- Day -- div label for=dob_dayDay/label select name=day value= id=day onchange= document.getElementById('birthdate').value = document.getElementById('month').value + '/' + document.getElementById('day').value + '/' + document.getElementById('year').value; option selected=selected value=Day/option ?php for($i=1;$i=31;$i++) { echo option . $i . /option; } ? /select /div !-- Year -- div label for=dob_yearYear/label select name=year value= id=year onchange= document.getElementById('birthdate').value = document.getElementById('month').value + '/' + document.getElementById('day').value + '/' + document.getElementById('year').value; option selected=selected value=Year/option ?php for($i=2005;$i=2008;$i++) { echo option . $i . /option; } ? /select
[jQuery] jquery 1.2.1 script not working with 1.3.2
I've been working with this script that is used within to group a parent row with it's children, and then expand the children rows out when you click on the parent. I'm having trouble getting it to work in internet explorer using jquery-1.3.2.min.js The original script was using jquery-1.2.1.js. Is some of this code outdated? and what could I replace it with? $(function() { $('tr.parent') .css(cursor,pointer) .attr(title,Click to expand/collapse) .click(function(){ $(this).siblings('.child-'+this.id).toggle(); }); $('t...@class^=child-]').hide().children('td'); }); It doesn't list any error on the page, it just doesn't toggle the children to visible when you click the parent row. Here is a demo page where I got the script from: http://www.javascripttoolbox.com/jquery/#expandablerows Thanks!
[jQuery] Re: jquery 1.2.1 script not working with 1.3.2
$('t...@class^=child-]').hide().children('td'); Get rid of any @ for attribute selectors. In jQuery 1.3 we went to css standard syntax, which does not use the @.
[jQuery] Re: My table tags are getting stripped out.
Am I missing something? Well, *we're* missing something, like the markup that goes with the code. Can you point to a sample page maybe? Is #CalendarBody the TABLE tag? If so, you should be appending a THEAD or TBODY tag to it. Instead of returning HTML fragments, you might want to return JSON with just the data and then have the client do the formatting. I'm not familiar with the asp.net MVC ContentResult so I don't know if that's possible or not.
[jQuery] Re: SimpleModal (probably something really stupid)
I would strongly suggest downloading the one of the demos [1], like the basic one, which will probably help answer all of your questions. -Eric [1] http://www.ericmmartin.com/projects/simplemodal-demos/ On Jan 7, 7:57 pm, polarwarp polarw...@gmail.com wrote: I am using the jquery simplemodal code to display a div on a page. I am pretty much calling .modal(); on the div, which has a class on it, and I'm styling up that class - some issues though: 1. How do I add a close button. Have seen that I can add a closeimg style - but I can't get anything with this class to appear. I figure I need to set the closehtml property to something but haven't figured out what. As this is embedded in c# I might have stuffed up my string escaping. string termconditions = @$('# + pnlMemberAgreement.ClientID + ').modal({ closeHTML: ''});; I also tried a href=#Close/a instead of just '' - but either its making no difference or I can't figure out what quotations to use within my c# string. .simplemodal-container a.modalCloseImg { background:url(../App_Themes/Images/Ecommerce/x.png) no-repeat; width:25px; height:29px; display:inline; z-index:3200; position:absolute; top:-14px; right:-18px; cursor:pointer; } 2. Whilst the div is made visible, it sits under my content - its not being overlayed over the top, nor does it have a background colour going on. I grabbed from the sample site: .simplemodal-overlay { background-color:#000; cursor:wait; } .simplemodal-container { height:400px; width:600px; background-color:#fff; border:3px solid #ccc; } Is this an additional option I need to set? 3. The div is not acting like a modal object - I can still click other buttons and stuff on the same page and leave the page! 4. I'm confused with the styling. what do I need to put on my div so that the right styles get applied to it - or should I be doing this in options? ie. I have my tc inside a panel, and I tried putting a css class on that for the container part, but where do I put the overlay - or should I not have to do this. It sort of looks like the basic modal example does what I want it to do.. but I can't figure out what I have missed in my implementation of it :( I pretty much have this in my c# string termconditions = @$('# + pnlMemberAgreement.ClientID + ').modal();; and want to apply some basic stylings so that the frontend guy can take over but it will do what its supposed to Thanks for any assistance!
[jQuery] Re: Jquery validation remote problem
I figured something out.. in de js file of the validator is the next section: formatAndAdd: function( element, rule ) { var message = this.defaultMessage( element, rule.method ), theregex = /\$?\{(\d+)\}/g; if ( typeof message == function ) { //message = message.call(this, rule.parameters, element); original line message = jQuery.format(message.replace(theregex, '{$1}'), rule.parameters); // replaced line } else if (theregex.test(message)) { message = jQuery.format(message.replace(theregex, '{$1}'), rule.parameters); } this.errorList.push({ message: message, element: element }); The first time the field is validated the script goes to the else if, the second time you focus/blur the field the first rule of the if kikck in and returns the filname or [object][OBJECT]... So I replaced the first if with the same statement as the else if and it seems to work fine now. I know this is not a neat solution, and i also don't know why it works now as it does... if you know a better solution, please let me know!
[jQuery] Re: 2nd Trigger for images hover function
How many DIVs of class tv do you have? One? And you want an other DIV to trigger the cross-fade on the tv DIV? If that is the case... $(document).ready(function () { $('div.tv, #theOtherDiv').hover(function () { var div = $('div.tv div'); if (div.is(':animated')) { div.stop().fadeTo(500, 1); } else { div.fadeIn(250); } }, function () { var div = $('div.tv div'); if (div.is(':animated')) { div.stop().fadeTo(1000, 0); } else { div.fadeOut(1000); } });
Re: [jQuery] hidden values associated with options of dropdown
you'd likely find this a lot easier by either using a database or array search here's an example using JSON. All of the information is stored in JSON until needed and can be searched easily with $.each http://jsbin.com/ohulu/edit CreativeMind wrote: Hi, I need the ways to solve the problem. scenario is: I have a dropdown and 4 textboxes, which are filled through a callback function. dropdown has multiple values. on selected index change of dropdown i want to fill the text boxes with associated values. e.g dropdown has list of countries. when i select country, the four textboxes are filled with country's four city names. like if india is selected , then textboxes should have delhi, banglore,mumbai,hyderabad if uk is selected, textboxes be filled with london,bermingham,scotland.manchester. if usa is selected then newyork,washington,pentagon,texas be in four textboxes. what i'm currently doing is: -- in code below i'm appending the new dropdown options retrieved from callback function, and also appending the associated cities in hidden input types. var sourcedropdown = $(e.target).parent().parent().children(":nth- child(7)").children().eq(0); $(sourcedropdown).append($('option/option').val(val).html (sourcename).addClass('selectedval'+val)); var cityval=text[1]; $.each(cityval,function(leftval,rightval){ $(sourcedropdown).append("input type=hidden id=hid"+leftval+" value="+rightval+" "); }); bydefault [select country] is added in dropdown with no associated cities, -- $(sourcedropdown).change(function(){ // how can i get cities in textboxes }); generated code of my above code is: select name="source" id="source0" option value="-1"Select country/option option value="0" england/optioninput type="hidden" value="london" id="hid1"/input type="hidden" value="birmingham" id="hid2"/input type="hidden" value="liverpool" id="hid3"/input type="hidden" value="leeds" id="hid4"/ /select --- this is ok for one country but not ok for more than one country.. any different way to associate cities with countries? thanx
[jQuery] using .live() with Beauty Tip - is it possible?
I'm using Beauty tip http://www.lullabot.com/files/bt/bt-latest/DEMO/index.html for example such as: $('.myclass').bt({ content: 'test content' }); which displays a nice tooltip. But how can I use it with jQuerys live event so that dynamically added classes will also work with the tip? I can't get the syntax working. Thanks.
[jQuery] Anybody ever come up with a good way of doing dynamic CSS?
Basic idea is a template: .card .ct-$(type) { width: x -- John Arrowwood John (at) Irie (dash) Inc (dot) com John (at) Arrowwood Photography (dot) com John (at) Hanlons Razor (dot) com -- http://www.irie-inc.com/ http://arrowwood.blogspot.com/
[jQuery] Re: Anybody ever come up with a good way of doing dynamic CSS?
Sorry, I hit tab/space which auto-sent. Let's try to finish this... Basic idea is a template: .card .ct-$(type.id()) { width: x; /* etc. */ color: $(type.color()); } In truth, it is a little more complicated, because I have to make lots of rules for all different classes, but the key element is that they have different colors (at least), and I want to be able to define them based on configuration that I loaded via AJAX, which defines the types. Now, I need to take the existing CSS file, loop through all possible values of object 'type' and then generate new CSS and make it be included in the document. I've seen the 'rules' plugin. I suppose I could fetch my 'template' css file, do find/replace on it to substitute the appropriate values (once per type), and then use the Rules plugin to add the rules to the current document. But I wonder: Is there a more elegant (client-side) solution? Has anyone else ever done client-side CSS rule generation based on data returned from the database? I'm just looking for people's ideas of 'best practices' since I know that CSS doesn't yet support macros (right?). On Fri, Jan 8, 2010 at 11:20 PM, John Arrowwood j...@irie-inc.com wrote:} -- John Arrowwood John (at) Irie (dash) Inc (dot) com John (at) Arrowwood Photography (dot) com John (at) Hanlons Razor (dot) com -- http://www.irie-inc.com/ http://arrowwood.blogspot.com/