Handle click event differently based on html elements
Hi, I want my page to call func1 when anywhere in the page is clicked, but with the exceptions of 2 html elements, when these 2 html elements are clicked, func2 will be called. How do I do that with jQuery? Thanks
how to validate the website url
how to validate website url entered in textbox...........
Image swap in a slider in a lightbox in a...
All, Trying to layer some functions here in what is proving to be a rather complex way. Essentially, these are the three functions that need to be nested: A lightbox to open on top of the page Within the lightbox, a slider to switch between portfolio items An image swap or fader to flip between the two sides of each portfolio item. The other variable is that I'm using lazy loading of the images to avoid loading 30+MB initially. I'm having a great deal of trouble finding plug ins that play nice with
How to get div id at caret position
How to get div id at caret position in jquery? for example my main div is main-box and mouse position is on <div id="content"></div> <div id="main-box"> ........ <div id="wrap" class="clearfix"> ............ <div id="header"> ........ <div id="content"> ............... <div id="section1"> ...... </div> <div id="section2"> ........ </div> </div> </div> </div> <script type="text/javascript"> $(document).ready(function(){ $('#main-box').click(function() { alert(getCaretPosition(this)); }); }); function
Jquery hide and show not working
Hi, I am new to jquery and learning it. I am facing a problem while I use jquery hide and show. I want to show the error message below the login form from the success call back if some condition is not met. But the error message is appearing for a while and disappearing and I am left with login form. Please help. Please find the code at http://jsfiddle.net/yxW8L/1/ $.ajax({ url : "/RestTest/rest/getJson", type : "POST", dataType : "json", data : inputdata,
How to get response from ajax method with jsonp?
Hi dears, I'm using this code to call ASP.net web service on remote server: $.ajax({ type: "GET", url: 'http://url', data: "parameter=hello", dataType: "jsonp", contentType: "text/xml", success: function (data, textStatus, jqXHR) { alert(data.length); }, complete: function (jqXHR, textStatus) { alert('complete'); }, error: function (jqXHR, textStatus, errorThrow) { alert('error function'); } });But no alert and I got error: SyntaxError:
JQuery and XML to create table in HTML
Hi - First off thank you to anyone who can help me. I am trying to create a HTML table using JQuery and I can't seem to get it right. Here is what I have so far. $(document).ready(function(){ $.get('/WellCityPartners.xml', function(xml){ $(xml).find('Partners').each(function(){ var backgroundurl = $(this).find('backgroundURL').text(); var hrefurl = $(this).find('hrefURL').text(); var imgurl = $(this).find('imgURL').text();
:eq() vs .eq()
I wanted to know if there was an advantage to using the :eq() selector over the .eq() method? For example: If I wanted to select the second-column cell in a table row, is it more efficient for me to use $("table tr td:eq(1)") as opposed to $("table tr td").eq(1)? Logically, it seems to me that best practices call for the former rather than the latter because the latter selector grabs much more than what I'm interested in. Am I correct in thinking this?
Expanding DIV As You Scroll?
I'm having trouble creating this page layout. My client wants to have fixed tabs at the top, a search area that scrolls out of view with the page, an area below with buttons and then a container with overflow that spans from the button area to the bottom of the page below that. No problem, except when you scroll they want the table container to expand and fill the space. I basically looking to do what's in this jsfiddle but have the bottom of the "Grid Table" stick to the bottom of the browser window
UTF8 issue?
Hi, I've got a bit of an annoying issue, where the accents in the page title, seem to be getting "corrupt". When you view them in console.log, the accents look fine. However, the $.post seems to break it: where=http%3A%2F%2Fwww.chambres-d-hotes.org%2FRecherche%2F%3Fquery%3DEsp%25E9raza%2B%252811260%2529&title=Chambre+d'h%C3%B4te+Esp%C3%A9raza+(11260)&t=luna The code (I've taken a chunk out, as its quite a complex function :)) $(document).on('click','.recommend-page', function(result) {
on pressing tab it is not moving to next tab
I am creating tab using html css and jquery. I am not using jquery ui. Let me explain the problem. in tabs there are Many tabs.every tabs contains texbox,drop down,checkbox, etc. for example when user in the first tab. in this tab text boxes are there. when user come to last text box when it is pressing the tabkey it will move to next tab's first element(like textbox/dropdown etc).I created this but it is not moving to tabs textbox. the code is available on pastebin and js fiddle. i not find findout
How to replace a text with something else
Hi I'm trying to create a newsletter signup where there is a button that says sign up and when a user clicks on it the button disappears and a textbox shows up and then when the user has clicked the submit button and it goes through the validation checks it then disappears and gets replaced with a thank you
Uncaught SyntaxError: Unexpected token
Dear all, I’m facing an issue that seems to be common but I can’t find any solution even after hours of googling. One of my php script do the following : <?php $param = array("fld1" => "firstname", "fld2" => "lastname"); ?> <button id="edit-btn" onclick="view_lead_make_editable_field(<?php echo json_encode($param) ?>)">Modifier</button> The javascript function is function view_lead_make_editable_field(json_param){ var obj = JSON.parse(json_param); alert(obj.count); } But looking at chrome
Styling with JQuery
I want to add styling using jquery. What Iwant to happen is when the "cliterace" is clicked the "cliterace" becomes bold and enlarged the code I have so far is <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <style> .organ { font-size: 46px; font-weight: bold; } </style> </head> <body> <a href="#">Cliterace</a> <script src="js/jquery.js"></script> <script> $("a").click(function( event ){ $("a").addClass("organ"); }); </script> </body> </html>
Problems with writing a variable inside a function
Hi, I am new to asking questions on this forum. Here it goes: ---- var image1 = $('#LBimage2 img').attr( 'src' ); $('#LBimage2').click(function(){ $('#LBimage1').html( ' <img src="image1" /> ' ); }); ------- When i click on the div LBimage2 i should get the LBimage1 to have the same image as the LBimage2, but it doesn't find the image soo it doesn't replace it....
Simple Parent/Next Issue
Currently getting the value from a name field but with multiple products, I tried with next/previous but as I am new to this I am having issues, the code below kinda works but obviously not the desired result. $('[name=my-item-price]').each(function() { var itemprice = $(this).val(); $('.price').text(itemprice); }); <form method="post" action="" class="jcart"> <fieldset> <input type="hidden" name="my-item-price" value="1495" /> <li>Price: $<span class="price"></span></li> </fieldset> <fieldset>
Pulling the first element out of an jqXHR object
Hey Guys. I am just curios to find out how is it possible to pull the first element out of an object. I couldn't anything in the doumentation that can help me. Below I have preforming an ajax get call from an xml file. I would like to know how I can access the first element. Below is my jquery code... <script> $.get('xml.xml',function (xml){ $("#result").append($(xml).find("speaker").text()); }); </script> </head> <body> <div id="result"></div>
Need Help Parsing JSON code
Hey guys. I am new to parsing JSON. I am trying to use jQuery to parse through a json file but it doesn't seem to be working . I am using firebug to debug this. I can see that the data has been parsed from the $.parseJSON function, but when I hover over the json var it says "undefined" Anyone know what I might be doing wrong here?? Below is my code <script> $(function(){ $.getJSON('json.json', function (data) { var json = $.parseJSON(data);
<a href='/a'>a</a>
I am using jQuery 1.8 and I noticed that there is this in the code: <a href='/a'>a</a>It is also in jQuery 1.7, although with a style declaration. What is this used for? I actually have an /a directory already on my website.
Problems with onload changing the same selector
Hello, I have less experience with jQuery, and now having some problems, I hope someone can help with this simple code. The purpose is to get 3 selectors updated with their corresponding values (retrieved from database), so that they can be modified and saved. 2nd selector depends on first selector value, and 3rd selector depends on 2nd selector value. For that purpose I placed a function onload="start();" in the body section, and that start() function calls 2 other functions. I believe the problem
Problems with outlook
I'am HTML document with Jquery and I need stripes in mij table, with online editor we have the result we need, but the same document in Outlook gives the table without the stripes Can somebody tell me why it doesn't work ? Thanks for all the help
Trouble including jquery in html file
So, I have a javascript file that contains my jquery. It's very simple jquery: var divs = $('div[id^="quote"]').hide(), i = 0; (function cycle() { divs.eq(i).fadeIn(400) .delay(1000) .fadeOut(400, cycle); i = ++i % divs.length; })(); What I can't understand is when I include jquery and my file in my header: <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="quoteChange.js"></script> It DOESN'T WORK. my html to change: <div class="quotes"
increasing div height by scrolling
Hi everybody, after days of reading and trying to find out how to solve this problem, I give up and hope that you guys can help me! I got one div, let’s say {height: 0px} now if I scroll down the body for 500px I want the height of the div to increase for every px I scrolled for 1px. So that when i finished scrolling the div’s height is also 500px. I tried many ways to solve this problem. The closest I got was using .scroll and .animate, but it still didn’t bring up the effect I want it to be. I
What is the best practice for dynamic CSS sizing according screen do you have information on less-CSS
Hi, Here I gave some code I did that is running BUT I imaginated it and I believe this solution is not very practical to use. MY PURPOSE IS TO GENERATE DYNAMIC CSS. I have used media query in the begining but I cannont size for every screen so many they become now a days. @media screen and (max-width: 485px) { body { text-align:center; font:0.9em "trebuchet ms", helvetica, arial, sans-serif; background-color:blue; word-wrap: break-word; } .mytable { width:400px; } } so I created a JQUERY script
Issue with a jquery slider login panel
Dear all, I am trying to build a website and using a slider login panel created by Web-kreation for loggin in users. On the user page I have created a menu using css and there are some forms to be filled. Once the user navigates the webpages using the menu buttons or the form buttons, the slider panel suddenly starts to fall and open with each such button click. So I have to press the close button again and again to close the panel. Does anybody have any idea why this is happening and how I can
Trigger from iframe to parent window
Hello. I have this structure: Index.html: <html> <head> <script src="jquery-1.3.2.min.js"></script> <script> $(document).ready(function(){ $('iframe').bind('myCustomTrigger', function() { alert('hello'); }); }); </script> </head> <body> <iframe src="iframe_file.html" width="800px" height="600px"> </iframe> </body> </html>iframe_file.html: <html> <head> <script src="jquery-1.3.2.min.js"></script> <script> $(document).ready(function(){ $('button_click').click(function()
Using jQuery to change text on button
Hi guys, I am a bit stuck on changing the text on my toggle button (see here). Essentially, before it is clicked, the button's text says "Hide Summary". When clicked, Box 2 slides up and I've managed to change the text to "Show Summary". When I click the button again, Box 2 slides down, but the text remains as "Show Summary". What am I doing wrong? Could you help me, please? Many thanks in advance. I look forward to your reply. Ess'iele ... seeing things.
Different Behavior Depending on Page Location
I have Firefox26/Firebug1.12.6. I have two browser windows open. In one window I am pulling a page from localhost. The other window, the page is from an intranet site, dev1.example.com. The pages are exactly the same and use jQuery1.7.2. Yet, the localhost will not execute the submit() statement. The page from the intranet does. $('img.autosubmit').each(function(){ console.log('Auto-submitting '+'this:'+$(this).attr('src')+' '+'parent-form:'+$(this).parents('form').attr('id')); $(this).parents('form').submit();
Getting a google map marker from localStorage?
Hi, If I use the click event of a google map marker to place it in local storage how would I use it? Will it be as simple as: function setactivemarker() { var activemarker = JSON.parse(localStorage.getItem("activemarker")); activemarker.setMap(MYDIRMAP.map); // this is a different map than the original one the marker was placed on and I want to reassign it the preceding map. } Do I need to use JSON.stringify when I store the active marker? What will activemarker actually be? Thanks for
checkbox .change works strange.
This code should alert just once a click. But it multiplies the amount of clicks. Try clicking multiple times. <script type="text/javascript"> function mcheckbox(){ $("input").change(function() { alert("checked"); }); } </script></head><body> <form> <input type="checkbox" name="box3" id="mbox1" onclick="mcheckbox();">Checkbox1<br> </form> The next works well, but it fires on all clicks: <script type="text/javascript"> $(document).ready(function(){ $("input").change(function()
JQuery method .on() with load event
Hello! I'm stuck with the .on method and I'm hopping one of you can give me an advice how to do it. That's what I have so far, but unfortunately it's not working. $('#content').on('load', '.something', function() { console.log("never reached"); // some ajax stuff goes here }); I wanna load some ajax stuff after the page is ready. Ok, so far there is no need for the .on() method. I could realize it also without. The problem is that if I replace my content by loading the next page over
weird error msg (to me)
I am getting this error msg that references jQuery: TypeError: 'checkValidity' called on an object that does not implement interface HTMLTextAreaElement. I am using 10.2. The code that is executing (or not executing really) at this point is a selectable, that is several LI in side a UL inside a div. I select something from the list which sets the value of a variable, I then click a button which is supposed to send the string as an object to a jsp. Thanks for any help. //get correct query translation
jquery.quicksand default tab on page load
When the page loads all the images show up on "all" tab, i tried to change the javascript and html so it can show on "web-design" tab or any other tab i choose when the page loads and it only shows one image and not all of them like the "all" tab. I have also removed the "all" tab on the html and change "all" to "web-design" in the script.js, but that didnt seem to work. Heres what i have. HTML code <h4 class="filter-portfolio"> <a class="all" id="active-imgs" href="#">All</a> / <a class="web-design"
cannot get the width or height on load
I want to get an element height onload to apply the same height to another element but I get always 0 html <img src="any.jpg" id="get" /> <div id="set">azer rzetreter </div> jquery var $h = $('#get').height(); $('#set').height($h + 'px'); how can I make it that it works ? thank you
Running jQuery's $(document).ready(function() {…}); inside an Ajax response
I have an application that builds page content from multiple page fragments comprising the template page. One or more of these fragments need to run JavaScript when the document has loaded, and it does not make sense to put fragment specific code in the template page comprising the fragments. While this approach has worked out for me quite well, I have a problem when attempting to update a fragment via Ajax based on the user's interaction with the page. I am using jQuery and $(document).ready(function()
[jQuery] Intercepting AJAX responses globally
Hi all, I'm trying to write a global AJAX response handler which hooks in *before* the client code receives requested data. The response data from the server might be in JSON or HTML format depending on where the request has come from. I'm trying to build in some client-side handling in case the user's login session ends between page load and asynchronous request. The server-side is easy - if the request wants JSON just return "{login_required: true}", if HTML then something like "<span id="login_required"></span>"
The resizeend event
Hi guys, I was irritated how Firefox and Chrome fire the resize event multiple times while the user resizes the browser window, so I wrote a little script to deal with that... The issues... Firefox = if you resize the browser window using the "resize area" at the bottom right corner of the window, then the resize event will be fired every ~20ms for as long as you drag the corner of the window. Chrome = if you resize the browser window, the resize event will be fired twice !! Since I want to run some
Issue with Internet Explorer playing video on click using YouTube API
This works perfectly in every browser except Internet Explorer. I can't figure out what exactly it is. http://jsfiddle.net/JmqCt/ 1. An image loads up. You click it and the video plays. This works in every browser. 2. Once the video is done this is where it stops working in Internet Explorer. The tabs drop down and when you hover over each one an image shows. When you click on the tab the video plays. This part doesn't work in Internet Explorer and I've tried to solve it but can't Any help would
Appending variable to a URL pending the value of a cookie
Hi guys, I am wondering if this is possible. If document.cookie; = value "U" Append This to all href's If document.cookie; = value "P" Append This to all href's So basically: U value adds ?appendu to the URL on all Hyperlinks on the page domain.com?appendu P value adds ?appendp to the URL on all Hyperlinks on the page domain.com?appendp Looking for some direction
Limit items returned via $.each
Hi all, Is there a way to limit the number of items returned within an $.each statement. I know I can use $top= in my REST call, but I need the logic to limit the number of results with an $.each statement (ex. the source data has 20 results which $.each iterates through and I need to display 3). Thanks! Kelly
Next Page