Slide Up on click on body when the element is shown
This is my code I need to Slide up the menu when the user clicks on any part of the body. $('.show-menu').click(function(event) { event.preventDefault(); $(this).addClass('active'); $(this).next('.menu-filter').slideDown(300); }); if($('.menu-filter').is(':visible')){ $('body').click(function(event) { event.preventDefault(); $('.show-menu').removeClass('active'); $('.menu-filter').slideUp(300); }); }
rotator that works on desktop and pc
Hi I have been asked to make a site mobile friendly, and so am making it responsive - no problems there. however, the site has an image rotator on the front page that's made with flash, so I figured I'd replace that with a jquery affair. The site is coded in xhtml4.1 trans with css2. I am not sure what the best way to proceed for the image rotator is - I was hoping to get one jquery solution that works on iPhones, android etc as well as desktop. However, when I start my googling I discover that there
jquery slideshow with text across fading in and out
Hi I am working on a three image slideshow. As they say a picture is worth a thousand words. But it would be even nicer If I could also have text fading in and out across the image slider. <head> <script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="../js/jquery.cycle.js"></script> <script type="text/javascript" $(document).ready(function(){ S("#slideshow").cycle() }); </script> <style> #slideshow{ width: 800px; height: 200px;
how to use the .text() method with variable text to insert
I have a JSON object full of text strings. I also have a function to change the HTML text depending upon the user's selected country, which they can change around at will. Most of the function works, but the expression with .text()(function(){ }) does not change the HTML text. What do I need to change? Is the problem in the function or in the object? Here is relevant code. var countryText = { "eng":[ { "US":[ { "stateMessage2"
find sequence of characters in paragraph with several spans
Hi, is there an easy jQuery way to get a sequence of characters like: e.g.: 'wor' in <p><span>wo</span><span>rd</span></p> and replace it with for example: <p><span><span style=backgroundcolor:yellow>wo</span></span><span><span style=backgroundcolor:yellow>r</span>d</span></p>
Convert AJAX call from jQuery 1.4 to 1.8
I have the following code that works well if I use jQuery 1.4 however I would like to upgrade to latest version 1.8 and this code returns '0 error' when jQuery above 1.5 is used. Would someone know what i need to change to make it 1.8 compatible please. <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>PA Web Test</title> <script src="jquery-1.8.0.js" type="text/javascript"></script> <script type="text/javascript"> var offset = 0; var howMany
finding words that are scattered in several nodes
Hi, I'm finding words in a text, which code below works: $('p *',$(frame).contents()).each(function(){ $('*',this).contents().add($(this).contents()).filter(function(){ return this.nodeType==3 && $.trim($(this).text()).length>0 }).each(function(){ if(!($(this).parent()).hasClass('HL')){ var html=$(this).text(); var compare=$(this).text(); html=html.replace(new RegExp(text, "gi"),function(matched) {return "<span class='HL' style=background-color:#d2b0ff>" + matched + "</span>";});
Not able to Close the title of a Dialog with .dialog('close')
Here is Code , when .dialog('close') triggers only the content of dialog is closed and the title bar remains on the page , Does any one have idea am I using the wrong way to close dialog box ? function popDialog(){ if ($('#dialog').parents('.ui-dialog:visible').length) { $('#dialog').dialog('close'); } $("#dialog").dialog({ open: function(){ $(this).load('/privacy.jsp'); }, title: 'A dynamically loaded dialog' }); }
input text value after jquery ajax post
Hi, I have a textfield and a button next to this field. When I click this button, a javascript function is called, i get the value from the textfield and submit this value to an action using jquery ajax. The action is called successfully and i am able to perform whatever i wanted to do with the value submitted in the action. But, the next time when I enter a new value in the textfield and click the button, in the javascript function, when I get the value from the textfield to submit, the value
How to execute php in ready function?
I want to execute php in javascript file (js extension file) how can I do this? Thanks
scope inside module pattern
I want to organize my code better, so I started on a module pattern. But I'm stuck already at the beginning This is my code (just for purpose of my question I stripped a lot). I want to use the private var array 'product' to push a productId. However in the 'public access methods' part, that var is 'undefined'. So i can not push a value into the array. Does anyone know why or have a solution to this? I would be very happy with it. PRODUCTS_MODULE = {}; PRODUCTS_MODULE.create
what is wrong with this
Not able to replace this text with a word highlighted: $('p *',$('iframe').contents()).each(function(){ $('*',this).contents().add($(this).contents()).filter(function(){ return this.nodeType==3; }).each(function(){ var html=this.text(); html.replace(/subject/g,'<span style=backgroundcolor:yellow>subject<\span/>'); $(this).replaceWith(html); }) });
Validating value to check if its a valid time - can i use dateISO
Hey new to this but already in love with jquerry, its made my job so much easier can't beleive the time I wasted using other methods. Anyway still new to this so unsure if I can use dataISO to validate time value in terns of hh-mm-ss. Wc3 states ISODate include time, but just worried it only incuded if there also data in the values. If I can't use dateISO is there an otherway of doing it? Many Thanks Damien
before ajax doesn't work?
In these following codes $('#loading').('display', 'block'); doesn't work. What should I do? $('#loading').('display', 'block'); jQuery.support.cors = true; $.ajax({ type: "POST", url: "proxy.php", dataType: "xml", data: { source: "lastfm", wanted: keyword}, success: parseXml, error: function(xhr, ajaxOptions, thrownError){ alert(xhr.status); alert(thrownError); } }); $.ajax({ type: "POST", url: "proxy.php", dataType: "xml", data: { source: "lastfm",
How could I do this... ?
Hello, I have the next code in jquery: $(".tab_content").hide(); $("ul.tabs li:first-child").addClass("active").show(); $(".block").find(".tab_content:first").show(); $("ul.tabs li").click(function() { $(this).parent().find('li').removeClass("active"); $(this).addClass("active"); $(this).parents('.block').find(".tab_content").hide(); var activeTab = $(this).find("a").attr("href"); $(activeTab).show();
Aptana code completion with jquery1.8
Is there a way to get jquery code completion in Aptana 3 with v1.8? I only found instructions for older versions that wouldn't work with 1.8.
Pass Jquery output as a variable
Hi All, How do I assign the output of a read file to a variable that the rest of the page can use? For example the following alert outputs do not match - the first alert has the correct value for ouput (=the one in value.txt), but it doesn't carry over to the second alert. jQuery.get('http://localhost/value.txt',function(output){ alert(output); }); alert(output); <--- Thanks in advance
.find() does not find elements
Hello Community, I am new to jQuery and I came across a Problem with the find function. I got the following two lines in my code console.log($('ul.gallery')); console.log($("ul.gallery").find("img")); And the output in Opera Dragonfly looks like that As you can see, the find function does not find the img tags, but as you can also see, it is there. I don't know if this has something to do with that strange <::after> tag. And I don't know where this comes form. But I need a reference to that img
Beginner....and I mean BEGINNER
Can anyone point me in the direction of jQuery tutorials that are for the absolute beginner? The tuts that are on this site are even over my head. I have very little programming experience and what I do have is mostly HTML. Thanks in advance.
replace and Highlight single word or letter in node type 3
Hi, I'm trying to Highlight words in an iframe like this: $('p',$('iframe').contents()).each(function(){ $(this).find("* :contains('subject')").each(function(){ return this.nodeType==3; }).html(html().replace('subject','<span style=background-color:yellow>subject</span>')); }); I want to replace a letter or entire word with itself highlighted, but not having great results, Regards
SHOPPING CART
How can i get my items to add up when I drop them? Is there anyone out there that might be able to help me out? I have created my files and here is the link: http://resourcesonline.us/JAVA/2/store.html I would also like the trash button to empty the cart and then show the ".emptycart" div. I also want to create an Empty Your Cart Link I want to have this link click-able and open a "Dialog" popup, asking the user to confirm emptying their entire cart. any help would be greatly appreciated.
Outside ready function
I already read some existing posts here and searched on google and still nothing. $(document).ready(function() { nav = function() { return { on: function(id) { $(id).addClass('test'); } } } }); How can i call the function on outside the document.ready. I also did try window.nav and $.nav and the effect is the same. It will only work if its in document.ready.
two strings comparing
I'm comparing two strings exactly equal, but this doesn't seem to work; var id='example1/example2' arrId=id.split('/'); $('div',$('iframe').contents()).each(function(){ var div=$(this); $.each(arrId, function(index, item) { $.each(div.attr('id').split('/'), function(i, l) { if(item==l) alert('equal') }); }); }); regards
Unable to animate a div background.
Hello everyone, First I just want to say THANKS for your time. I have a little problem on my head. I'm trying to make a div move it's background image when hovering a button (the button is a different div) You can see where I'm now Background changes without animation : http://jsfiddle.net/onlynoise/9Y9Bv/92/ With animation it doesn't work : http://jsfiddle.net/onlynoise/9Y9Bv/98/ This is my first go at jQuery so please be very noob friendly. Thx ! P.S. I got some result using a little help from
HTML entities
Hi, I'm sending a file to the server with: method='post' enctype='multipart/form-data' If have this text: [text...=...text] in the server I will get [text=text]. However, if I have [text...P...text], I will get [text...P...text]. In the server i'm using Jsoup and DiskFileUpload. Regards
how to get the container
having this: $('* p',$(frame).contents())...{ } p is the container where the search will be done. $(this) is each content. How can I get the p?
set a variable without clicking or posting
I'm trying use this as a 404.shtml error page: <script src="http://code.jquery.com/jquery-latest.js"></script> <script language="javascript" type="text/javascript"> var viewportwidth; var viewportheight; /* the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight */ if (typeof window.innerWidth != 'undefined'){ viewportwidth = window.innerWidth, viewportheight = window.innerHeight } else if (typeof document.documentElement != 'undefined' && typeof
Loop not working.
Hi, folks. I'm trying to make an animation loop till the end of times, but i'm not reaching success in the way i'm writing the script. Hope you take a look and help me to figure out a way to make it work. The html is this: <div id="elementosPrimeiros"> <div class="elemento pincel"> <img src="../Imagem/pincel_lapis.jpg" /> <div class="descricaoElemento"> <h4>Boa Aparência</h4> <h5>Design direcionado e de qualidade.</h5>
Basic link question from newbe
I want to make a simple link using <a> tags to start the following autosrolling which is defined below and is part of a bigger code I have already. Can anybody help me with the code for this link? Is the information below enough to write this link? // Start auto scrolling $("#startAutoScrolling").click(function () { $("div#makeMeScrollable").smoothDivScroll("startAutoScrolling"); }); Thanks!
replaceWith, keeps reference of replaced object?
Hi, I replace an element with another element: $("iframe").each(function(){ var frame=$(this); $(this).contents().find("div").each(function(){ var ID=$(this).attr('pid'); var span=document.createElement("span"); span.innerHTML=$(this).html(); span.setAttribute('pid',ID); $(this).replaceWith( $(span) ); }); });The div disappears. However, if after this I make a find in frame contents, with a scrollTo to each find it moves to the disappeared div, despite not being there.
New jQuery eBook: Master Space and Time With JavaScript
Some of you may be interested in the new eBook series Master Space and Time With JavaScript, available at http://www.noelrappin.com/mstwjs. Master Space and Time With JavaScript gives you guidance on how to approach the simple parts of your JavaScript code first and how to manage the complex parts as needed, with a strong test-first focus. It is a four book series aimed at developers who have a basic knowledge of JavaScript but who need to learn about newer tools and practices. The first book, which
cant get 2 jquery codes to work on same page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Image Hover Move- simple and practical navigation or featured image jQuery plugin</title> <link href="jimgMenu.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/jquery.js"></script><script type="text/javascript"
How to make multiple dropdown for the same images?
Hi, Please help in following issue, Whenever I click the first arrow icon in below image, I am able to get the below dropdown, but, My problem is, I am unable to get the dropdown when I click the remaining arrows. I need to show dropdown menu when I click all the arrows. help me in this issue, thanks in adv.. Suren
Count nr of divs apply class to every fifth
Hi, i have a structure which looks like <row> <div class="onecol"></div> <div class="onecol"></div> <div class="onecol"></div> <div class="onecol"></div> <div class="onecol last"></div> <div class="onecol"></div> <div class="onecol"></div> <div class="onecol"></div> <div class="onecol"></div> <div class="onecol last"></div> </row> all divs are generated dynamic, so the amount can vary from 5 to 25 divs. Is it possible to set a rule saying, apply class "last" to every fifth div with the class "onecol"?
Datepicker change the date format to DD, d MM yy..and i have it working But !
Me and my datepicker again haha,, Looking to change the date format to DD, d MM yy..and i have it working,, with this code : <script> jQuery.datepicker.setDefaults({dateFormat:"DD, d MM yy"}); </script> Or this <script> $.datepicker.setDefaults({dateFormat: 'DD, d MM yy'}); <!-- $('#datepicker1, #datepicker2').datepicker(); --> </script> but its not how the demo show you, This being the Demo and the rest of my code: Demo <script type="text/javascript">
difference in length innerText and text()
Hi,Why does this give different results? var v=document.createElement("br"); alert("v"+$(v).text().length+v.outerHTML): returns zero alert("vg "+$(v).get(0).innerText.length): returns 1Regards
closing tags check <br/> <input/>
Hi, How to check if an element has or not a closing tag? Example: 'input' and 'br' have no closing tags. Is there a way to know when traversing nodes? Regards
trying to learn custom functions / methods in jQuery
I have some code that initializes text when the user changes country and when the page load determines the country from W3C geocoding. It works in Firefox and Chrome, but not IE, and Firebug says changeCountry is not a function. $('input[name=country]').change(function changeCountry(countryChangeCounter){ countrySelected = $('input[name=country]:checked').val(); //sets country abbreviation //do stuff }).filter(':checked').trigger('change'); //at ready, fire a change on the
difference beween ,contents() and contents().contents()
Hi, To get all textnodes in a paragraph I'm doing this: $('* p',$(frame).contents()).contents().filter(function(){ return this.nodeType == 3; }).wrap("<span/>"); because if I do it with just one contents() call: $('* p',$(frame).contents())..filter(function(){ return this.nodeType == 3; }).wrap("<span/>"); it won't get me all the textnodes. Shouldn't just one call to contents() get all the textnodes at once? Regards
How to get the return from the get method in a input field
Hi togehter, i have a problem: I want to get a variable from another site via ajax get. Here my code: $(document).ready(function() { $("button:first").click(function(){ $.get("text.cfc?method=checkIBAN", { iban: $("#testfeld").val() }, function(data){ $('#test').html(data); $('#testfelder').val(data.html); }); }); }); So I the right staff back but I want to fill the input field with this return. It doesnt work..
Next Page