Access to global variable within jQuery?
I assume it's a problem with the scope, but no matter what I try, I can't get the variable to accessible within jQuery. I understand that variables created within a function are only accessible by that function. But global variable should be accessible also within functions, no? I define a global variable on a page using Google maps. Using a jQuery function, I then draw a marker and push that marker to the global variable. When I try to remove the marker, using a click event jQuery I can't get the
Removing multiple lines
Hi all, I am pretty new to jQ and I am trying to write up a command line interfaces that will removes a particular section / lines of codes within a list of json files. By the way, the json file are located within the sub-folders of the main directory Well, I came up with this code find -name "*.json" | xargs sed -i "map" but I came to realize that I will not be able to achieve the outputs that I wanted as some of the json files I had, its format and contents are slightly different too. So far I
Getting parent window filed name to popup window and retrieving checked checkbox values from popup window to parent window (Using jQuery)
Hi, I have a requirement where I need to bring the parent window field value to popup window. In the popup window I have many check boxes which upon selection, will be concatenated and should be brought back to parent window against the field. Could some one give an idea or any link to achieve that. We tried doing to open a div as a popup but with no help. The page looks like in the attached image.
Can jQuery retain the original color of a selected dropdown item?
My <select> ...<option> sequence displays a dropdown list of items and each item happens to have its own background color. However, when one of the items is selected the background turns to a standard blue. Can I use jQuery to either avoid this color change or restore the original color. Thanks
drop down link wont work
Drop down link wont work once clicked. I notice that when I click drop down, I got hash character in url e.g. ...reports/home_members/search_customer# Then once clicked it will not work anymore. I have to click to some link first before it work again. Any ideas?
ajax to php (POST)
hey guys im trying to post data to php via ajax...now ive tested the script and it seems like the problem is the data being sent...casue if i return json data without relying on data being sent from the ajax request then it works perfect. so my question is how do i sent the data correctly so i can get it in my $_POST variable. $.ajax({ dataType: "json", type: "POST", data: "{'category': '" + category + "'}", // problem url: "http://url.com/category/sub-categories",
Post-image move before post-header on each single-post through jquery
I want if some body add div with class "post-image". It will automatically move it before div with class "post-header" and do this function on each div with class single-post. E.g. this is main //'post-image' after 'post-header' <div class='single-post'> <div class='post-header'>Title</div> <div class='post-image'><img src='.../img1.png'/></div> </div> <div class='single-post'> <div class='post-header'>Title</div> <div class='post-image'><img src='.../img2.png'/></div> </div> and i want this like
using jQuery in user script in Chrome
Is there an official guide on how to use jQuery in a user script in Chrome? A Chrome user script is like a greasemonkey script in Firefox.
Callback function of $.get logs only two asterisks.
Hello, I am trying to use "console.log" to view the response of the server. My code is as follows : <script type="text/javascript"> $.get("process.php", function(response){ console.log(response); }); </script>And the only thing my browser logs are two asterisks. The PHP code was as the code below: <?php if ($_GET){ $rec = $_GET["name"]; $msg = "Welcome, " . $rec . "!"; return $msg; } else { return "No data recieved by the Server"; } ?>Would you be kind to guide me throught solving this problem?
how can I attach event to change in element prop (disable)
hello: thankshow can I? attach event to change in element prop (disable) so when element1 is change to disable - an event listener will trigger func thanks
Query a JSON in Google Maps
Hi I have a Google maps page that is is working quite fine so far. I add a number of markers to the map using a function and a static JSON. I would now like to replace the static JSON and query the data using jQuery/AJAX. I have tried various options, but somehow I keep getting the error, that the JSON is not defined. I feel I'm just missing a small thing. Currently I create the markers using this function call, where planes is the static JSON holding the information regarding the markers: setPlanes(map,
Hover on touch doesn't work !
The pseudo-element hover does not work on touch devices, I'm looking for jquery code recommendations to over come this hurdle which I'm presently facing ?
Selecting dynamic checkbox
Kindly help me in this problem- I have been adding dynamic checkboxes associates with the records got fetched from database.I have a checkbox so that selecting it make all other dynamic checkboxes selected. here is snippet- $('# tbl_A').on("click",".chk_all",function(event){ //chk.all is the class of //select all checkbox if($(this).checked) { $('.chk_cls_candidate').each(function(){//.chk_cls_candidate refers to class of other dynamically generated checkbox $(this).checked=true; }); } else
jQuery wowslider problems
Hi, I'm working on a (free, hobby) website for a local parish church, and have included a jquery photoslider, Wowslider. It works fine locally, but when I upload it, the "live" version of the slider breaks - with the images not loading and the div being completely oversized and pushing out the rest of the page content. I'm really lost as to why it's happening, and don't really know where to start in my troubleshooting. Is there something I need to add, or take out, to get the jquery to run happily
How to create a specific JQuery UI Slider box that follows the handler?
I am trying to create a jQuery UI slider that makes a box follow the handler, it is supposed to resemble the slider on this website - https://www.betterment.com/pricing/ - I would like to create one such so that the value changes just like the content on the picture underneath From my research from other questions at the following underneath: Jquery UI slider how to make a box follow the handler? I managed to create a simple one in JsFiddle shown here: http://jsfiddle.net/mvnvu5qq/1/ - I would like
Another Question About .data()
Say you have a button A that brings up a dialog box. And the dialog box itself has a button B. When the user clicks button A, you want to store some data that you will use later (when the the user eventually clicks button B). I'm using the .data() function to store the data on button B itself. However, it's not working. The data is not available in the handler for button B. I store the data as follows: $('#buttonB').data('myData', theData); Button B looks like this: <Button onclick="handleButtonBClick(this)">
Animation stops while page is loading in safari
I have a site that is experiencing some slow load times that i'm trying to diagnose and fix. In the meantime I've set up a loading that animates across the bottom of the page as soon as a user clicks to navigate to a new page. This works great in every browser expect Safari (both mobile and desktop). I have verified that the animation itself works in Safari by adding starting the animation on page load. The problem is that as soon as you click to navigate the animation stops. Is there any way around
Hi, i need help to create a recursive function to read all list structure
Hi, i need help to create a recursive function to read all list structure. I need "alert()" the content inside of each "<li>" start from the first <ul> until the last one. Bellow follows an example of list to works.... important... the function must be unchangeble.,, but must result the result accordly i change the list... <ul> <li>A</li> <li>B</li> <li>C</li> <li>D <ul> <li>A.1</li> <li>A.2</li> <li>A.3 <ul>
Disabling button loaded after the document is ready
Hi; I need to disable a submit button that is loaded dinamically after the document is ready. I have no problem to do this using the document on event and triggering elements events: $(document).on("click","a.button.saveForm", function () { $(".detail-button").attr("disabled", "disabled"); }); The problem is that I have not found the way to change de attribute of the button without using this kinds of events. Is there any way to change the attributes of any element loaded after document is ready
need a little help with toggle menu
I am building a new site which uses a drop down or toggle type menu from the top of the screen. Now the site has two menus effectively. One is the nav for the site, the other is the social media nav. Im using the following to activate the menus: $(".menu_toggle").click(function() { $(this).toggleClass("active"); $(".menu").slideToggle() }); $(".social_toggle").click(function() { $(this).toggleClass("active"); $(".social").slideToggle() }); Ideally I would like it to action only one of these and by
.html() for old version of browsers
hi, Im using .html() function of Jquery in my website but old version of browsers doesn't support it what shall I do?
required field on show/hide div base on drop down
Hi, I have drop down field to show hidden div (that has field) when he/she selects the "OTHERS" value. It works fine, But, I want it the user to type something in the field (that has required) before she/he submits the form. here's my script <script text="text/javascript"> $(function() { $('#customer_id').on('change',function(){ if( $(this).val()==="Others"){ $("#other_valid_id").show() } else{
Syntax error when including jquery
Hello all! I've been trying to include jquery in one of my pages as it's required by lightbox. However, whenever I insert <script type="text/javascript" src="/includes/javascript/jquery-1.11.2.js"></script> into the <head> section of the page, lightbox reports that "jQuery is not defined." The error console in Firefox has this to say: "Error: SyntaxError: syntax error Source file: http://zf1.farstrider.local/includes/javascript/jquery-1.11.2.js Line 1 <br />" There is no <br /> tag anywhere
Easy filter script
Hello I'm trying to do an easy filter script to show the elements I want to see depending the option I've chosen. I don't want to use an external script. I'd like to do it by myself. On the one hand, I have the option in two lists <ul class =" provincias "> <li data-provfil =" 6 ">Text</li> ... </ul> <ul class =" categorias "> <li data-catfil =" 6 ">Text</li> ... </ul> and, on the other hand, I've the elements: <section> <article> <header>
jQuery UI Multiselect
Hi, I found this multiselect here : http://www.quasipartikel.at/multiselect/ I was trying to use it in a fiddle : http://jsfiddle.net/mlotfi/5o1uxog3/ could you please tell me what I am missing here ? thanks lot.
Only one function works depending on where place?
In the code below it has two find then hide query. Depending on which one is higher in the script is the one that will work. However i need them both to work. Does anyone see an issue? Ive tried merging and doing variables but then the offer button never hides. $(document).ready(function(){ var source = $('#urlp').text() + "/make-an-offer #bstr"; var name = $('#ProductDetails .BlockContent h2').text(); var url = window.location.href; $('.modal-header h3').text("Make an Offer for "+name); $('.modal-body').load(source,function(){$('#contact_question').val("I
jQuery replaceWith and restore the scrollposition
Hi. I have a DIV position absolute and on overflow scroll. Whenever status changes whole DIV is replaced with a new. The problem now is before the scroll animate event triggers . The DIV is set scroll position to 0 and starts from the top and not from where it was before. How to call replaceWith(newDiv,true) to keep the scroll position. This issue is discussed here http://stackoverflow.com/questions/2009029/restoring-page-scroll-position-with-jquery Thanks B L Praveen
Invoke a function parameter from table cell click
Hi there, I try to build a function that create a table dynamically using jQuery, the function accept an array of objects as parameter, each object in the array is the data for creating a single row. One of the object items in the array is a javascript function that I'd like to invoke when user click a table cell code is here Problem is the click event does not work.
I click on first div two times then click on the second div one time but get alert two times that "You have clicked on the second div"
<html> <head> <script src="http://code.jquery.com/jquery-1.10.2.js"></script> <script> function myfun() { alert("You have clicked on first div"); $(".def").click(function () { alert("You have clicked on the second div"); }); } </script> <style> div { border: 1px solid blue; width :200px; height: 200px; margin : 30px; } </style> </head> <body> <div class="abc" onclick="myfun();">First Div</div> <div class="def">Second Div</div> </body> </html>
Uncaught SyntaxError: Unexpected token var (using switchButton)
am trying to read a data attribute from switchButton event, but I got this error : Uncaught SyntaxError: Unexpected token var Here is the fiddle : http://jsfiddle.net/mlotfi/pot095x3/ Thanks.
jQuery problem with resizing divs
The code may seem lengthy, but it really is just a bunch of repetitions. But the length is irrelevant, just pay attention to the resize event, which is defined first thing inside the ready() function of jQuery. My test page displays 4 divs. My objective is to cover up these 4 divs with 4 other divs I created during runtime with jQuery and be able to survive any kind of browser resizing. When the code is run, click the buttons labeled "Cover Div 1", "Cover Div 2", "Cover Div 3", and "Cover Div 4".
How to manipulate XML and post back to original XML file
Note: All of the code in this question pertains to local data. This is not going to be on a web server, but locally on the PC running the code. I have an XML file (current_jobs.xml) and an XSLT & CSS file to style it. I am currently showing the XML file via an HTML file using Javascript. <html> <head> <title>Job Board</title> <meta charset="utf-8"/> <link rel="stylesheet" href="style.css"/> <script type="text/javascript" src="jScript.js"></script> <script type="text/javascript" src="jquery-1.11.2.js"></script>
Problem with patch for ajax timeout reporting
Currently it appears not to be possible to know, in the ajax error callback, if the request has failed due to a timeout, versus some other reason. Knowing this is important for implementation of a good UI, which wants to be able to say more than "timeout or other error". I propose having the "status" parameter contain string "timeout" when the error is due to a timeout. try
Apache, PHP install problems
Hello, Im trying to install apache and php on my windows desktop. So far I have met with abject failure. I have gone through dozens of demo's and provider installs, since apache doesnt provide binaries any longer. Does anyone know of any link that can help me install apache and php? God knows Ive tried just about all of them. ThankYou
Javascript and jquery does not support IE8 but supports chrome..?
Hi there, I have added jquery and javascript code for my website which is working fine for chrome browser. But it doesnot work on internet explorer.Can you please tell me what might be the probelm behind it.. This is my code; Any help is appreciated.. <script src="//code.jquery.com/jquery-1.10.0.min.js"></script> <script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> var current; var currentIndex=0; var element; var topPos; function showParamsDdl(id) { if ( event.which
Show/hide element (of option list) from other form element
I have two form's elements: checkboxes and drop-down list. Checkbox value is link with drop-down list by id (option id=checkbox val) The option list should be hide by default. After checkbox is checked I want to show specific options from the list. Unfortunately it doesn;t work properly. My code: <input type="checkbox" name="newsletter" value="Hourly">Hourly <input type="checkbox" name="newsletter" value="Daily">Daily <input type="checkbox" name="newsletter" value="Weekly">Weekly <input type="checkbox"
javascript how to sort strings containing comma separated values
I would like to know how can I sort strings in javascript containing comma separated values in different order e.g. 1. Need to remove the distance "Km" 2. Sort values comma delimited ASC 3. append the distances to each distance input value "10km,50km, 21.1km"; result "50km,21.1km,10km";Your help will be appreciated. Thanks
Get all values of a Dropdownlist which is not multiple enabled
Hi all, I was wondering if it is possible to retrieve all values of a dropdownlist which is not MULTIPLE enabled. This is the code i have that may work on a multiple enabled dropdownlist. But in my case, i dont want to allow the user to select more than one value from the dropdownlist. var values = []; $('#my_dropdown option').each(function() { values.push( $(this).attr('value') ); }); And on submit, i want to post the entire array of content on the dropdownlist. Is it possible? Someone please
Read (invalid) value of input
Hello all, Using JQM 1.4.2 I have a problem with inputs that require (standard/default) validation. For example if I have an <input id="v1" type="number"> and I enter the value "12a" my input becomes invalid, which is ok. But, if I then get document.getElementById("v1").value() I do not retrieve the invalid value "12a" but get an empty value instead, leading to the wrong error indication feedback to the user. Is there any way to get the actual value of the input control? The same problem appears
weird response
Hello Folks, I am jQuery newbie. I encountered a really weird response must be my mistake somewhere. I have been researching on internet for 2 days but not found my thing so finally decided to seek help from experts. What I wrote is here. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script> $(document).ready(function() { $("input[name='radioship']").change(function(){ $("form").submit(); }); }); </script> <form action="" method="post" name="frmCart" action="go.php">
Next Page