jquery

JS: Using variable names to call function.

Im working with jQuery. I have an app that makes ajax requests to server that responds with JSON. in some cases the response from the server will indicate the name of a JS function to be called {"responseType":"callback", "callback":"STUFF.TestCallback","callbackData":"this is in the callback"} If the responseType is "callback" as a...

how to deal with google map inside of a hidden div (Updated picture)

i have a page and a google map is inside a hidden div at first. I then show the div after i click a link but only the top left of the map shows up. i tried having this code run after the click: map0.onResize(); or: google.maps.event.trigger(map0, 'resize') any ideas. here is an image of what i see after showing the div wit...

Flexigrid: window.resize problem

Hi, I managed to come up with a code that can make flexigrid more "fluid", more specifically it can resize depending on the window size on page load, but now I would like to add the function to resize automatically when the size of the window changes without refreshing it. This is what I have so far: $(document).ready(function(){ var ...

jQuery Plugin/JavaScript: Set body-class with actual URL

Hello, I know there are JavaScripts or jQuery plugins which set some body classes (e.g. something like that <body class="ff3.5 ff win gecko some-awesome-icons-article-with-100-icons">) I don't know how that is called...? Do you know what I mean and have you a link/name of it? The path to the article set as css-body-class is more importa...

Use jQuery to unbind a click handler that wasn't added with jQuery?

I want to use jQuery to remove a click event handler that wasn't added with jQuery. For example: <a onclick="alert('This was set by onclick.')" href="#">Click me</a> <script type="text/javascript"> $(document).ready(function(){ $("a").unbind(); // Why isn't this working? $("a").click(function(event){ alert("This was se...

How do I parse JSON like geo:point?

I'm trying to parse a JSON response using jquery from last.fm and getting longitude and latitude values. The part of the JSON that holds those values looks like this: "location":{"geo:point":{"geo:lat":"58.409901","geo:long":"15.563306"} The code I got is this: $.getJSON("http://ws.audioscrobbler.com/2.0/?method=artist.getevents&amp;...

How do I get it to change back to disabled in jQuery?

I have this example which works great. The buttons are disabled as default and if there is a radio button change to yes then the corresponding button is enabled. The problem is i need it to go back to disabled if they switch it back. The only time it should be enabled if the block has at least one radio button clicked yes ...

How to edit part of anchor in URL

I have code for get part of anchor: function _get_part(queryString, name) { var match = '&' + name + '='; var i = queryString.indexOf(match); if(i < 0) { match = name + '='; if(queryString.slice(0, match.length) == match) i = 0; } if(i > -1) { i += match.length; return queryString.slice(i, queryString.i...

jQuery prepend domain to text input

I have a domain (e.g: example.tld), and I want to allow users to create an e-mail address on this domain by only having to input the first half of the e-mail address. So the domain will be appended to the text box, and when the user clicks on the box the cursor will be at the start of the input field allowing them to enter their name. P...

concrete5: link not working in editing mode

When I login to my sites cms(concrete5), the jQuery-events won't fire anymore: I've built a site where certain parts should be editable. There is just one html and through jQuery I display/hide parts on that site. It is all working, except when I login, the navigation does not work anymore. The funny thing: If I rightclick a navigation-...

How do I enter 1300 CSV records into a web form?

Hi, I've got a fairly extensive data entry task to perform in a PHP application. The application allows you to enter one data set at a time (first name, last name, email), click 'Go', and then uses AJAX to submit the data and blanks the form, putting your cursor back in the first input. I have a data set of 1,300 that needs to be entere...

Return link for another (same) XMLHttpRequest

I have one link that makes an ajax request and it prints by XHR request another link same at this one before cliked so it's like a loop: starting XHR from <a href="javascript:void(0)" class="doXHR">do XHR</a> than into Ajax success function i repeat into my html this link: <a href="javascript:void(0)" class="doXHR">do XHR</a> but...

menu in jquery for black background

If possible please have a nice easy menu horizontally at jquery on a black background ...

jQuery: replace image.

I have this: <div id="userPhoto"> <a href="profil.php?id=<?php echo $sid; ?>"> <img src="images/profilePhoto/thumbs/<?php if($vP["photo"]){ echo $vP["photo_thumb"]; }else{ echo "noPhoto_thumb.jpg"; } ?>" style="float: left; border: 2px solid #CCC; margin-right: 5px; margin-left: 15px; margin-bottom: 2px; width: 44px; heigh...

What is the meaning of "callback.call( value, i, value )" in jQuery's each method?

each() method in jQuery contains such a statement: callback.call( value, i, value ) I couldn't understand what this statement means exactly. I know what callback and call mean but I couldn't get the arguments of the function call: (value,i,value). What does this mean? The statement is used in a for block of each() but my question...

Rails - AJAX a Modal Dialog?

Hello, I'm interested in learning how to AJAX a modal dialog. Typically if I wanted to add a modal dialog to my web site I added the jquery UI dialog code in my main JS file and binded it to an ID. I believe with Rails I can create a Link, which fetches all the dialog code from the server and then opens the dialog. Is this true? If so...

How can I extract a URL from url("http://www.example.com")?

I need to get the URL of an element's background image with jQuery: var foo = $('#id').css('background-image'); This results in something like url("http://www.example.com/image.gif"). How can I get just the "http://www.example.com/image.gif" part from that? typeof foo says it's a string, but the url() part makes me think that JavaSc...

jQuery: same filename, wont load issue.

in html i got this: <div id="userPhoto"> <a href="profil.php?id=<?php echo $sid; ?>"> <img src="images/profilePhoto/thumbs/<?php if($vP["photo"]){ echo $vP["photo_thumb"]; }else{ echo "noPhoto_thumb.jpg"; } ?>" style="float: left; border: 2px solid #CCC; margin-right: 5px; margin-left: 15px; margin-bottom: 2px; width: 44px...

jquery plugin 'uploadify' - Way to return a response from upload script?

Hey guys.... I'm wondering is there any way this can be done? My header code for example is.. $(document).ready(function() { $('#sampleFile').uploadify({ 'uploader': 'include/uploadify/uploadify.swf', 'script': 'add_list.php', 'scriptData': {'mode': 'upload'}, 'fileDataName': 'sampleFile', 'f...

how to optimize 1 large compressed JS file for different pages? (code not needed everywhere)

I have one JS-file that is merged and compressed from several separate files. So when we start our app, there is only one http request for the JS-file which makes loading it really fast for all pages. But, a lot of the code is jquery in document.ready(). It binds events and other code to elements on certain pages, but not all code is ne...