[jQuery] Re: is there a better way, and extra click to show/hide in ie8
try using the click event instead of change
[jQuery] Re: Find array key of value
How does the user select which image he wants to view?
[jQuery] Re: jcarousel issues
The link doesn't seem to work...
[jQuery] Re: Problem with jquery tabs on live site
Have you considered giving us the link to the live site?
[jQuery] Re: How to be able to preload jquery contents into hidden tabs for ie browser
You say, you have jQuery code inside the DIVs? The code should be at the bottom of the page, right before you close BODY. NOTE! Instructions how to make it easier for us to help you: 1. Go here http://vidasp.net/HTML5-template.html 2. Copy the code into a text-editor. 3. Write a simple demo demonstrating your problem. 4. If you have an active hosting, put the demo online and reply the link here. Otherwise, copy the complete code and reply it here.
[jQuery] Re: jcarousel issues
I am completely unable to help you based on your supplied info. NOTE! Instructions how to make it easier for us to help you: 1. Go here http://vidasp.net/HTML5-template.html 2. Copy the code into a text-editor. 3. Write a simple demo demonstrating your problem. 4. If you have an active hosting, put the demo online and reply the link here. Otherwise, copy the complete code and reply it here.
[jQuery] Re: Superfish IE6 dies with opacity CSS attribute
You mean UL LI UL LI, instead of UL LI LI? Because you're not supposed to put LIs inside LIs...
[jQuery] Re: long-term browser support strategy
It would be really stupid (for a JS library) to cut off any browser with market-share above 1%, especially IE6 which won't go below 1% until maybe 2011. You can be sure, they won't do that. The big sites (Youtube, Facebook, ...) are doing a good job in asking their visitors to upgrade, but IE6 is (reportedly) big in companies where the regular employee cannot just upgrade if he wants to.
[jQuery] Re: Superfish IE6 dies with opacity CSS attribute
It violates the standard and you should avoid such practice. Proper nesting: ul liFirst ul liOne/li liTwo/li /ul /li liSecond/li /ul Please, put a demo of the problem online...
[jQuery] Re: Superfish IE6 dies with opacity CSS attribute
The selector ul li li is valid, of course.
[jQuery] Re: How to be able to preload jquery contents into hidden tabs for ie browser
LOL that's creative :) It certainly is not the best solution, but hey if it works
[jQuery] Re: Problem with jquery tabs on live site
I'm having a hard time finding the jQuery code that gets executed when you click on a tab...
[jQuery] Re: Selecting a value with up down keys
The code above is wrong... here: $().keydown(function(e) { var $item = $(.selected).removeClass(selected); if (e.keyCode === 40) { // bottom if ($item.next().is(li)) { $item.next().addClass(selected); alert($item.get(0).innerHTML); } } }); }); Also consider using a plug-in... http://jquery.bassistance.de/autocomplete/demo/
[jQuery] Re: Selecting a value with up down keys
Actually, this is right... $().keydown(function(e) { var $item = $(.selected); if (e.keyCode === 40) { // bottom if ($item.next().is(li)) { $item.removeClass(selected).next ().addClass(selected); alert($item.get(0).innerHTML); } } else if (e.keyCode === 38) { if ($item.prev().is(li)) { $item.removeClass(selected).prev ().addClass(selected); alert($item.get(0).innerHTML); } } }); });
[jQuery] Re: Link override problem
Your code is a mess :) To many DIVs/classes, and the jQuery code is really bad... it's hard to watch... I'd like to help but, from what you've supplied it's not possible for me to construct a demo... why don't you put a demo online? Or copy the complete code here?
[jQuery] Re: Making a Sliding Tab Menu
1. Why is your menu UL wrapped by a DIV, which is wrapped by a DIV? 2. Why do you have anchors (A) inside the menu items? 3. Why SPANs inside the anchors? Why not just this: ul id=nav liNews/li liTeam/li liGallery/li liContact/li /ul ul id=content li the content for the News tab /li li the content for the Team tab /li li the content for the Gallery tab /li li the content for the Contact tab /li /ul
[jQuery] Re: Selecting a value with up down keys
Here ... http://vidasp.net/jquery-example8.html
[jQuery] Re: Selecting a value with up down keys
I forgot to mention: don't get freaked out by the code... basically what you need is: $().keydown(function(e) { if (e.keyCode === 40) { // down cursor key was pressed } else if (e.keyCode === 38) { // up cursor key was pressed } });
[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] 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); } });
[jQuery] Re: Need help with a simple problem?
The click method has only one argument - the funcion that is going to be executed on every mouseclick. Also, you can use the show and hide methods as shortcuts for manipulating the display property. The toggles method toggles the display property between the states hide and show. $('#top-bar-login li.current').hover(function() { $(this).siblings(ul).show(); }, function() { $(this).siblings(ul).hide(); }); $('#top-bar-login li.current').click(function() { $(this).siblings(ul).toggle(); }); If you wanted to attach 2 or more functions to the click event, you could use the toggle method (same name as the one above, but different purpose)... $('#top-bar-login li.current').toggle(function() { $(this).siblings(ul).show(); }, function() { $(this).siblings(ul).hide(); }); Now, the first click will execute the first function, second click = second function, third click = first function again, and so on...
[jQuery] Re: Pass object to function
why not just $(a.less).live('click', function() { $(this).closest(.project).find(.morebody).slideUp (normal); return false; }); ??
[jQuery] Re: Pass object to function
$(a.less).livequery( 'click', function() { $(this).closest(.project).closeProject(); return false; }); $.fn.extend({ closeProject: function() { return this.each() { $(this).find(.morebody).slideUp('normal'); } } });
[jQuery] Re: How do i get this mega dropdown with jQuery??
Here, use this: http://vidasp.net/jquery-example7.html The HTML code is super-simple - only ULs and two wrapper DIVs Also, the menu streches to the full (available) width automatically (like a table)
[jQuery] Re: Help with change event
Hehe :) Look, event methods work like this you pass in a function, and that function will be executed then the event occurs... $(select).change(function() { // code that gets executed when change event the occurs on any SELECT element }); But, if you leave out the argument, then the change method does something completely different... it triggers the event... (as if you changed the selected OPTION(s) yourself) $(select).change(); What the guys at jQuery did in that example is, they first defined the onchange handler, and then triggered it right away... So you got that red Candy Caramel text on page load without having to change the SELECT...
[jQuery] Re: ie8 and title text value
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
[jQuery] Re: Need help learning
this refers to different objects depending on where we are in the code... (function($) { $.fn.myPlugin = function() { // here this refers to the jQuery object on which the myPlugin method was called upon this.each(function() { // here this refers to the matched elements in the jQuery object... in your example, you matched every DIV element, so this refers to each node in the DOM tree that has type = ELEMENT_NODE nodeName = DIV alert(this.id) $.get(return.php,function(data) { // here this refers to the options object for the AJAX request you may print it out with this code: for (prop in this) { $(div).append(prop + = + this[prop] + br); } alert(this.id); //do something with this the data }); }); return this; }; })(jQuery);
[jQuery] Re: Need help learning
If you want to manipulate with the DIV inside the $.get function, you can declare a local variable and put the reference to DIV in it... (function($) { $.fn.myPlugin = function() { this.each(function() { alert(this.id); var that = this; $.get(return.php,function(data) { // now this is that alert(that.id); //do something with this the data }); }); return this; }; })(jQuery); You don't have to call the variable that, but it's a nice name, isn't it? :)
[jQuery] Re: FireFox Pages flicker when jQuery reads a CSS attribute of a div
where's your demo? i've used the css() method on DIVs before and never noticed flickering...
[jQuery] Re: Element Exact Width
obj.html(obj.children().html()); obj.children() selects the SPAN that we created... obj.childern().html(), therefore, returns all the content of the SPAN, which was originally the content of the P we want to set the content back from the SPAN to the P... so, we have to put the content that we selected inside the html() method ... obj.html ( obj.children().html() )
[jQuery] Re: Anchor Child Not Responding to Hover
You mean this? http://vidasp.net/jquery-example5.html
[jQuery] Re: jquery too long to load
Well, it depends from which URL your're loading from... this one shoud be pretty fast: http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js Consider hiding the dropdown with CSS... hidden *is* the default state for it, anyway.
[jQuery] Re: jquery too long to load
Well, it is kind of slow... I'm here on vacation so I don't have the tools (firefox plug-ins) to analyze the situation... first, install the HttpFox plug-in and then, look what HTTP requests are made, at what time, in what order, how long they take to be answered if you want your page to seem responsive, the big header image should get displayed as soon as possible (also, try to reduce its size as much as possible) also, time the JS code... var time1 = new Date().getTime(); // all the JS code that gets executed on page load var time2 = new Date().getTime(); alert(time2 - time1); the number should, of course, be as low as possible...
[jQuery] Re: Select with different fonts for each element
I made it work in Firefox, but in IE it seems impossible to style each OPTION element individually, same problem in Chrome But, I have an idea... give me a minute :)
[jQuery] Re: Table striping still not working in IE7
Just an off the hip thought, IE7 may still have the pseudo issues in IE6 and earlier... http://vidasp.net/Internet%20Explorer%20and%20CSS.txt
[jQuery] Re: Select with different fonts for each element
OK, this is it :) We can call this version alpha 0.1... the code is super-messy, and it most certanly won't work if you just copy-paste it... but this example actually works in all browsers... http://vidasp.net/jquery-example6.html
[jQuery] Re: Select with different fonts for each element
I had to go play cards with my cousin, so i left the code messy... it has several bugs for now (try hovering over the list and then hovering out without clicking any item)... It should take my 30 minutes to refactor the code and kill the bugs...
[jQuery] Re: Select with different fonts for each element
Done! http://vidasp.net/jquery-example6.html
[jQuery] Formatting long chains of jQuery code
Is there a prefered way of formatting jQuery code when you have 5 or more chained methods? I came up with this... http://vidasp.net/jquery-example6.html (look at the code at the bottom of the source) ... how do you format it?
[jQuery] Re: Help on Independent DIV's that toggle!!
The A element is to be used to link to an web-resource, an you are not doing that. # (as in href=#) is not a URI for a web-resource, I'm not even sure that it is a valid URI at all. So to be clear, you are misusing the A element. OK, now, you have to set the href attribute to # and make the click handler return false (to prevent the default behavior). If you used a SPAN, these two steps would not be necessary. BTW, forgetting to return false in the handler would add another element to the window.history object, so hitting the Back button would not load the previous page (you would have to click it twice). So, you are: 1. going against the standard (misusing the A) 2. setting an invalid URI to the href attribute 3. doing 2 additional steps (setting href and returning false in handler) 4. taking the risk that you will at one occasion forget to return false in the handler which would mess up the Back button for the user just because you are to lazy (no offense) to put this in your CSS code: .slick-toggle { color:blue; text-decoration:underline; } .slick-toggle:hover { cursor:pointer; } But, chances are that you will have to style the slick-toggle class anyway (because blue underlined text with everything else inherited doesn't bring it anyway in most cases).
[jQuery] Re: jQuery does not stripe visible table rows correctly
The problem is that jQuery assigns a class of 'roweven' to odd numbered tr elements and a class of 'rowodd' to even numbered tr elements across all browsers. I've tested this on jQuery 1.3.2 and jQuery 1.3.1. The :even and :odd filters are zero-based, so if you select (in your example) 10 rows, the 1. row has index 0 and will be matched by the :even filter, the 2. row has index 1 and will be matched by :odd, and so on script type=text/javascript $(document).ready(function() { var j = 0; var rows = $('#foobar tbody tr:visible'); for (i = 0; i rows.length; i++){ j++; if (j % 2 == 0) { rows[i].className = 'roweven'; } else { rows[i].className = 'rowodd'; } }}); /script I changed these 2 lines... rows[i].className = 'roweven'; rows[i].className = 'rowodd'; to this: rows.eq(i).addClass('roweven'); rows.eq(i).addClass('rowodd'); and now it works in IE8
[jQuery] Re: jQuery does not stripe visible table rows correctly
Also, you really don't need two counters (i and j) var rows = $('#foobar tbody tr:visible'); for (var i = 0; i rows.length; i++){ if ((i + 1) % 2 == 0) { rows.eq(i).addClass('roweven'); } else { rows.eq(i).addClass('rowodd'); } } However, don't use the for loop, you have jQuery's each method... $('#foobar tbody tr:visible').each(function(i) { if ((i+1) % 2 === 0) { $(this).addClass('roweven'); } else { $(this).addClass('rowodd'); } });
[jQuery] Re: trying to do Math.min on 3 tds by excluding if one = 0
This shoud do the job... $(tr. + i).each(function() { var ithis = $(this).find(td:lt(3)).map(function() { if ($(this).html() === 0) { return null; } else { return this; } }).min(); $(this).find(td.r1).empty().append(roundVal(ithis)); }); so, you select the first 3 cells, and then do the map function, which is similar to each... for every selected cell, if its content is 0, then deselect it... so after the map function, you only have those cells that doesn't contain 0, on them you run min()
[jQuery] Re: jQuery does not stripe visible table rows correctly
Well, definitely the shorter version :) You can put a comment above to remind you that :even and :odd are tricky // Remember, :even and :odd are zero-based, so it's reversed $('#foobar tbody tr:visible:even').addClass('rowodd'); $('#foobar tbody tr:visible:odd').addClass('roweven');
[jQuery] Re: Element Exact Width
var width = $(p).wrapInner(span/span).children().width(); $(#myp).html($(p).children().html());
[jQuery] Re: Element Exact Width
1 error in the code above, this is right: var width = $(p).wrapInner(span/span).children().width(); $(p).html($(p).children().html());
[jQuery] Re: Element Exact Width
Better yet, make a function that you can reuse: function contentWidth(obj) { var width = obj.wrapInner(span/span).children().width(); obj.html(obj.children().html()); return width; } Now you can use the function like this... var width = contentWidth($(#myp));
[jQuery] Re: clone of div
$(#parentdiv).clone(true).insertAfter(#parentdiv);
[jQuery] Re: jQuery does not stripe visible table rows correctly
Nice :)
[jQuery] Re: Help on Independent DIV's that toggle!!
# actually is valid (sorry about that)... So. let' sum up... We want keyboard accessibility, so we have to use either a A, or a BUTTON / INPUT type=button... If we choose the A element, we have to set the href attribute (I'd rather set it to '#, than to deal with fragment identifiers... we won't use them anyway), and we have to return false from the handler... If we choose a BUTTON element, we have to deal with browser inconsistencies regarding the visual appearance...
[jQuery] Re: clone of div
Well, the clone will have the same ID (interestingly)... but only the first (original) DIV will be selected if you use the id selector... I suggest changing the ID of the clone right after you create it... $(#div1).clone(true).attr(id, div2).insertAfter(#div1);
[jQuery] Re: animate() not working for opacity in IE
This filter property is causing your problem, just remove it... You can see here, if you just set the opacity, it'll work fine even in IE... http://vidasp.net/jquery-example4.html
[jQuery] Re: Help on Independent DIV's that toggle!!
Scott, you used A elements as JS triggers which is not proper... the A element is for linking to other web-resources. If you need an element for onclick JS execution, just use a button or a SPAN element The one time where you do bind click event handlers to A elements, is to prevent the default action, for example, load the content by AJAX, rather than to reload the entire page, but this is not the case here, as you do not have an default action ( href=# )
[jQuery] Re: Does anybody know when jquery 1.3.3 or 1.4 will be released?
I read somewhere, on January 14th
[jQuery] Re: trying to do Math.min on 3 tds by excluding if one = 0
I'm not sure what youre trying to do here... but the jQuery object does not contain the min() method as a property. To use the Math.min method, you give the values as arguments... var xmin = Math.min(x1, x2, x3);
[jQuery] Re: Referring to the current DOM object in a jQuery method parameter list
This should do the job: $(#someid).each(function() { $(this).text($(this).attr(alt)); }); It is longer and more unreadable than your original code $(#someId).text($(#someId).attr(alt)); but you do get rid of redundancy = you do not have to write the same selector twice, which is generally bad in programming... for a simple selector like #someid, you may write it your way, but for a complex selector, writing it twice is a bad idea..
[jQuery] Re: :parent selector is confusing
Well, :parent is the complement of :empty, so maybe :not-empty :)
[jQuery] Re: Issue with css() when appending marginLeft
I don't think the position property was set to fixed in the first place... the css method can take either an string, or an string and another valuer of any type, or a map of key/values... so if you want to set more than one property at once, use a map: css({bottom: 40px, position: fixed, marginLeft: -176px});
[jQuery] HTML5 template
It's pretty useful for me (when testing, etc) http://vidasp.net/template.html
[jQuery] Re: How to change a form action?
Well, Ive tested in Firefox and IE8 and it works.
[jQuery] Re: How cani achieve this functionality?
The combo is a SELECT element, why shouldn't you be able to write inside it? For every character keyup event, you AJAX load the OPTION elements and put them inside the SELECT:::
[jQuery] Re: Documentation for ~= selector
Is there a attribute other then the class attribute where you have a space-seperated list of values? If not, the *= should be good enough.
[jQuery] Re: joining arrays
Well, running the map method on an jQuery method doesn't transform it into an array therefore, your variables arr1 and arr2 are still jQuery objects First, it's easier to collect all IDs directly from the selector: var myarray = $(#employees input[id$='Bonus'], #employees input[id $='Salary']).map(function() { return $(this).attr(id); }); Now, myarray is an jQuery object containing all the properties like any other jQuery object, but also all IDs as objects inside inexed keys... This should work: $.each(myarray, function() { alert(String(this)); });
[jQuery] Re: JQuery hanging for unknown reason
Well, put the demo online...
[jQuery] Re: Documentation for ~= selector
Well, good to know that it works in jQuery... i thought they left it out intentionally :)
[jQuery] Re: Help on Independent DIV's that toggle!!
Here is my solution: The HTML structure of each DIV: div class=article p Basic content /p p class=details Additional content /p /div The JS code: // the clickable more details SPAN element (as a string) var $showMore = span class='showMore'More Details/span; // the function that hides the second P, and adds the SPAN to the first P function hideDetails(div) { $(div) .find(p:first).append($showMore) .end().find(.details).hide(); } $(document).ready(function() { // do the initialization for every DIV with class .articles $(.article).each(function() { hideDetails(this); }); // attach a live click event handler to every more details SPAN element $(.showMore).live(click, function() { $(this).closest(.article).find(.details).slideToggle(400); $(this).text($(this).text() == 'More Details' ? 'Close' : 'More Details'); }); }); Because the handler was attached to an live event, you can now dynamically create DIVs, for example: $(div class='article'/div) .append(pAnother basic contentp) .append(p class='details'Another additional content/p) .appendTo(body) .each(function() { hideDetails(this); }); This solution works in the way that if JS is turned off, the second P will be visible, and there will be no More details SPAN.
[jQuery] Re: In a row trasversing, finding, counting...
closest(tr) is better than parents(tr:first)
[jQuery] Re: Jquery + ie7 spans
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; This one is better :) !DOCTYPE html Or at least this one: !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/ TR/html4/strict.dtd
[jQuery] Re: menu hover question
You should put your submenus inside the top-level menu items like this ul liFirst item ul liFirst item of the first item/li liSecond item of the first item/li /ul /li liSecond item ul liFirst item of the second item/li liSecond item of the second item/li /ul /li
[jQuery] Re: open drodown
I haven't looked at your code actually, but the idea of opening the select by increasing its size sounded nice so I tested around a little bit and the result is IMHO quite nice... http://vidasp.net/jquery-example3.html ... the select opens up on hover so it spares you the extra click to open it up :)
[jQuery] Re: using :gt - Firefox error console annouces an error
I just used an rediculous string like my super selector to point out that Firefox shoudn't care what we put inside $() As long as you know that the string is valid for jQuery and you get the expected results, you shoudn't care about warnings from Firefox
[jQuery] Re: live event with instant execution
The load event wont help you... it has to do with stuff having finished loading, but you are creating new elements based on an AJAX response, so the new elements are not being loaded at all. Well, you can allways initialize the elements after you create them I can't see the problem For example. 1. you get the AJAX response 2. you create new elements 3. you initialize them
[jQuery] Re: using :gt - Firefox error console annouces an error
Yes, I get the same message... but it's not an error, it's just a warning :) And this particular warning tells us that Firefox is not aware of jQuery selectors, at least not of the :gt() selector, but, as long as you know that it is a valid selector (and it works), you should just ignore the warning Another question would be, why Firefox examines the selector string inside the $() function in the first place I mean, we could write $ (my super selector) and Firefox should not throw a warning, because $ () accepts a string as an argument and we gave it a string, so it should be fine well, jQuery will not know what to do with the string, because it's neither a selector string nor a HTML code string... but that's jQuery's problem, and not Firefox's...
[jQuery] Re: live event with instant execution
What does initiating elements mean?
[jQuery] Re: AJAX request
I did some testing and didn't experience your problems... give us your code or put a demo online Another thing... you should also check if the input value has changed since the last keyup event, so you don't send the same data if for example the ENTER or SHIFT keys are pressed you can store the input value for every keyup event and than compare it with the value of the previous keyup event like this $(#term).keyup(function() { if (($(this).val().length = 3) ($(this).data(currentValue) ! == $(this).val())) { // do AJAX request } $(this).data(currentValue, $(this).val()); return false; }); Also returning false is a nice idea, so that ancestor keyup events don't trigger this handler
[jQuery] Re: Jquery + ie7 spans
Why do you bother with quirks mode? Doesn't having a good DOCTYPE avoid triggering quirks mode? BTW, IE8 in quirks has this problem also, not just IE7
[jQuery] Re: half protected text input box - help
Well, you can use Firebug to easily locate the code only the part you write is a textbox .tumblr.com isn't the code is basically like this div input type=text / .tumblr.com /div
[jQuery] Re: click(function{ problem with Firefox
Yea, that happens if you don't follow the standard some browser will break your code :) For a comprehensive overview of propper HTML nesting rules, consult my diagram: http://vidasp.net/HTMLstructure.htm
[jQuery] Re: Attaching an event to a non-existing element?
First, in your code above you set a value to the window.location property... I believe, the value type must be string so this would be valid: window.location = http://www.google.com/;; Second, I haven't heard the term combo box in relation to HTML you mean a SELECT element, right? To answer your question, I don't see why you couldn't attach the event handler after the AJAX response 1. You get the AJAX response 2. You create the combo box 3. You append it to the DOM 4. You attach an event handler to it
[jQuery] Re: Sub menu - long line of text
Well, show us the code - HTML and CSS I can hardly help you based on the information you provided above...
[jQuery] Re: Attaching an event to a non-existing element?
3. I have set this response as the content of an empty div. That select element appears well, but maybe it doesn't appear as a DOM member, so that's why I can't attach an event handler to it. If you place HTML code inside an element that is in the DOM tree (like the empty DIV in your example), than the code gets parsed and all HTML elements inside the code are added to the DOM tree... Basically, if you can see it on the page, than it's in the DOM tree I noticed in your code above, you used the wrong name for the method... it's called change, not onchange $('#term2').change(function(){ window.location = http://www.google.com/;; }
[jQuery] Re: $(checkbox).css('background-color',value) does not work on FireFox?
So, on Safari, the code for the checkbox passes. On Firefox, it does not. Funny thing, the input element has a style for the background color, but .css('background-color') is not returning the color I set. It is returning rgb(255,255,255). What do you mean by in Safari the code passes ? From my own testing, setting a background-color on checkboxes has visual effect only in IE and Opera... but not FF, Safari and Chrome. Also, what do you mean by the input element has a style for the background color ?
[jQuery] Re: js function to jQuery
Well, it actually gets even shorter... you can combine the two selectors into one jQuery(#TreeviewTd, #MenuBarTd).toggle(); I have no experience with the UpdatePanel, but I encourage you to get rid of all other AJAX libraries and stick to jQuery... Can you tell me why jQuery(document).ready(function(){...}); doesn't work when UpdatePanel is present?
[jQuery] Re: How to validate fields
I don't get what you mean. Show us the code...
[jQuery] Re: How to validate fields
You mean this? http://vidasp.net/jquery-example2.html
[jQuery] Re: $(checkbox).css('background-color',value) does not work on FireFox?
I did some more testing and it is true that Firefox is the only mayor browser that returns the white color, instead of the actual background color... However, if you use the camelcase notation it will work even in Firefox. $(#mycheckbox).css(backgroundColor); // works in all browsers $(#mycheckbox).css(background-color); // works in all browsers except Firefox This should be a good reason to allways use camelcase inside the css() method. *** I also did some analysis on the style object of the checkbox. I set the background-color with this code: $(#cb).css(background-color, #fa0); Here are the relevant properties of the style object for every browser: Firefox: 0 = background-color backgroundColor = rgb(255, 170, 0) cssText = background-color: rgb(255, 170, 0); Internet Explorer: cssText = BACKGROUND-COLOR: #fa0 backgroundColor = #fa0 Safari: 0 = background-color cssText = background-color: rgb(255, 170, 0); Chrome: 0 = background-color cssText = background-color: rgb(255, 170, 0); Opera: background = #ffaa00 backgroundColor = #ffaa00 cssText = background-color: #ffaa00
[jQuery] Re: Latest JQuery File
LOL If you downloaded the jQuery library from www.jquery.com, than you can be sure that it's valid leave it as it is. It seems that the syntax highlighter in Dreamweaver isn't smart enough to cope with the advanced JS code from jQuery :)
[jQuery] Re: using :gt - Firefox error console annouces an error
This works fine in my Firefox 3.5.6 * !DOCTYPE html html head title/title /head body p class=ssome content/p p class=ssome content/p p class=ssome content/p p class=ssome content/p p class=ssome content/p p class=ssome content/p p class=ssome content/p p class=ssome content/p p class=ssome content/p p class=ssome content/p script src=jquery.js/script script $(document).ready(function() { $(.s:gt(2)).css(color, red); }); /script /body /html * Show us your code
[jQuery] Re: .attr issue in Chrome on Windows
Well, what is the value of the src attribute in Chrome (if it's not what is should be)? Have you made sure that the arguments t and filename are strings?
[jQuery] Re: how to access elements with index in for-loop
First of all, the wrong code is wrong, look this is your code: $(function(){ var trs = $(#tb tr:not(:first)) for( var i=0; i$trs.length; i++ ) { //$trs[i].find(td:eq(1)).attr(style,color:red); //wrong $trs.get(i).find(td:eq(1)).attr(style,color:red); //wrong } }) 1. you forgot to put semicolons at two places. $(function(){ var trs = $(#tb tr:not(:first)); -- HERE for( var i=0; i$trs.length; i++ ) { //$trs[i].find(td:eq(1)).attr(style,color:red); //wrong $trs.get(i).find(td:eq(1)).attr(style,color:red); //wrong } }); -- HERE 2. You declared a variable named trs but you than use a varibale named $trs which of course doesn't exist because you haven't declared it... $(function(){ var $trs = $(#tb tr:not(:first)); for( var i=0; i$trs.length; i++ ) { //$trs[i].find(td:eq(1)).attr(style,color:red); //wrong $trs.get(i).find(td:eq(1)).attr(style,color:red); //wrong } }); OK, now the code should work, right? Well, no... because what the get(i) method does is it returns the DOM element at index i from the $trs jQuery obect so after you do get (i), you no longer have an jQuery object, and you cannot call the find () method because it is not a property of DOM elements What you could do is encapsulate $trs.get(i) inside $() to get a jQuery object based on the DOM element, so this code does work: $($trs.get(i)).find(td:eq(1)).attr(style, color:red); However, this is a pretty stupid way to loop through a jQuery object... a better way is to use the each() method: $trs.each(function() { $(this).find(td:eq(1)).attr(style, color:blue); });
[jQuery] Re: jQuery Selector Help
Well, you selected BR elements, which are empty elements, so it's no mystery why this.innerHTML returns undefined... Also, DIVs shouldn't appear inside SPANs...
[jQuery] Re: js function to jQuery
Should be pretty easy: $(#CollapseExpandTd).click(function() { $(#TreeviewTd).toggle(); $(#MenuBarTd).toggle(); });
[jQuery] Re: Can't get onClick on appended elements
First: get the Web Developer Toolbar for Firefox Then run your page in it and if you have JavaScript errors, then the icon on the far right of the toolbar will be red... you can click it to view the error... for example have you assigned values to the fileName and filePath variables?
[jQuery] Re: Add class selected to a hyperlink in navibar! Help me.
HTML code: ul id=nav li asp:HyperLink ID=nav_page1 runat=server NavigateUrl=Page1.aspxPage 1/asp:HyperLink /li li asp:HyperLink ID=nav_page2 runat=server NavigateUrl=Page1.aspxPage 2/asp:HyperLink /li li asp:HyperLink ID=nav_page2 runat=server NavigateUrl=Page1.aspxPage 2/asp:HyperLink /li /ul C# code: protected void Page_Load(object sender, EventArgs e) { string navID = this.Page.ToString().Substring(4, this.Page.ToString ().Substring(4).Length - 5); HyperLink navHyperLink = null; switch (navID) { case page1: navHyperLink = nav_page1; break; case page2: navHyperLink = nav_page2; break; case page3: navHyperLink = nav_page3; break; default: break; } if (navHyperLink != null) { navHyperLink.CssClass = nav_opened; navHyperLink.Enabled = false; } } This is just the 1. version that works in the most basic cases but you get the picture ...
[jQuery] Re: Selecting radio button unselects text field and vice-versa
You mean this? http://vidasp.net/jquery-example.html
[jQuery] Re: Get the selected text and border it with tags
Say, we have an input box or a textarea. There are two words selected. I need to make them italic (i/i) if a button is clicked. You want to put i elements inside input type=text / or textarea ? That's not possible... input is an empty element, and textarea only accepts character data..
[jQuery] Re: Add class selected to a hyperlink in navibar! Help me.
You should add that class on the server-side everytime you click on a link, a new page is loaded, so the current page is overwritten together with your jQuery code...