I have the hover event set up. There are 100 elements in my document of the class square. What I want to do is return the ID of the current square that is hovered and edit the style=' ' attribute of the .square with that specific ID.
Basically what I'm trying to do is write a plug in which connects to a sharepoint web service, traverse the results of the xml document that is returned by the web service for certain elements, and then return a collection of xml elements which I can use in another function on the page that is calling the plugin.My code looks like this:Main Page
<script type="text/javascript"> $(document).ready(function() { var listItems = $.sharepoint();
I have a very simple PHP script that returns JSON like this: {"question":"What day is it?"}
And I'm trying to call it from another page using Ajax. My code looks like this: var url = "/test.php"; $.get(url, function(data){ $.each(data, function(i, value) { alert(value); }, "json" ); });
When I run it I get each character printed out one at a time in a separate alert. And then when I used this line of code: alert(typeof data); It tells me that 'data' is a string. Shouldn't it be a JSON object?
I've been going through the documentation for the deferred objects API, and one thing that's still not clear to me is : what jQuery functions are returning a deferred object?
The documentation seems to say that jQuery.ajax() and the animation functions like jQuery.fadeIn() does (what about jQuery UI effects?), but the pages for those functions say they return a jqXHR object and a plain jQuery object.
Need some help with my For loop. The issue is that, my loop is only returning the values of the last item in the js file. I want the select box to include all possible names.
From the code given below, I think it's pretty obvious what problem I'm having, but I'll explain:
Javascript is only returning HTML DOM attribute values when they are assigned by the javascript function, not when they are assigned by CSS. So, if I set the background colour of a div using CSS, then try to call that attribute value, JS doesn't return it, BUT, if I then assign a new value using JS, it can correctly read the attribute value.
What am I doing wrong? Or can javascript not pull HTML DOM attribute values assigned by CSS?[code]...
I'm just starting to try out "Ajax" web programming and I've got a question.
AJAX is fairly straightforward. Javascript creates an XMLHttp object and then uses that to generate a hidden webpage with your results.
What I'd like to know is, how can I retrieve multiple values from an XMLHttp request?For example, if my request generated an SQL query that returned a Name, Address and PhoneNumber, could I get those values directly instead of parsing them out of the ResponseText?
This is my current handler:
function showResult(pge) { var url="getResult.asp?sid=" + Math.random() + "&q=" + pge xmlHttp=GetXmlHttpObject(stateChanged) xmlHttp.open("GET", url , true) xmlHttp.send(null) }
function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { //Complete, so show results. document.getElementById("myResult").innerHTML=xmlHttp.responseText; //How to get mulitple values here? } }
I have 5 images on my page. What I want to do is, when ever I hover on one image, rest of the images have to become transparent. How to get this effect.
This is what I am using in the script.
$(document).ready(function () { $("#mainbuttons a img").hover(function () { $("#mainbuttons a img:not($(this))").css("opacity", ".5"), css("-ms-filter", "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"), css("filter",
I am trying to get the index of a li with a specific class. I know I'm selecting the right object because I can apply a CSS class to it (eg change border colour) but when I try to get the index it returns -1. But I know the object exists as I can alter it. :-s
jQuery(document).ready(function() { var active = $("#tertiarynavigation .bordered").get(0); var num = $("#tertiarynavigation li").index(active); alert("Index: " + num);
I have a list of things on a page that are dynamically generated and when I hover each of them I'd like a 'popup' with more info relative to what is hovered to appear.
I don't want to have to specify the rul for every popup separately so my question is how do I target a child div to appear for only the hovered element if there are many divs with the same name on the page?
I know this is simple and has been done before. I'm trying to create a dropdown menu for secondary links. I want it to appear when you hover over a primary link. I can't do a simple .hover function with two handlers because once the user moves the mouse to go into the secondary menu, it will slide back away.
The easy solution is to put that secondary menu within the selector of the primary menu - but it's not possible with my setup.
I've been looking for a solution to a dropdown menu problem where the button does not stay hovered when the list is navigated/as soon as the cursor leaves the button area. At the moment the effect is setup using css sprites (locally) but I have seperate images also for the 2 states.
I'm trying to make a javascript function that will change the style of <span> tags that are hovered over en-masse. Meaning every <span> tag with onmouseover and onmouseout with this function will change it's style. Currently, I'm trying to work from the getElementById standpoint, but this is unbelievably tedious.
I am working on getting this script to work on my page but can't get the hovered anchor to maintain it's state when moving to the mega menu. I'm hoping to have a tabbed look to the drop down much like at[URL]..
However, being new to jQuery this looks a bit daunting the way this script was written. I've seen examples coded much more simply than this one. This one seems like the author was trying to obfuscate the intent behind the code.
Is there an easy way to modify this code to allow for the anchor that triggers the event to maintain it's hover state even when moving to the drop-down?
Currently, I'm building a website with jQuery. The function below helps me to get content from a database. In the file content_ajax.php there are some functions to handle ajax-requests. JS calls the PHP-function correctly (I've send an email to myself inside that function to check) but the script doesn't return 'succes' and doesn't give me an error...Also, when I put an alert inside the succes and error function, it doesn't popup!
What may be relevant: - site uses mod_rewrite for friendly url's
I have this basic code following and its not returning anything at all. Even the alert is not alerting. I have checked and the select is sending the value fine But nothing happens on return. What i am missing?
I have a bunch of divs with the same classname, 'mediafield':
And I have this jquery code in my header:
So I know that the click function is getting implemented.. The alert box appears however I get the following error in firebug: uncaught exception: Syntax error, unrecognized expression:[@class=mediafield] Line 0
Nothing happens when firebug is turned off... So I'm not sure why it's throwing the error.
I'm working on a small project and want to create a simple dialog window. I know I can use a plug-in, however that is a bit of a over kill plus its a good way to learn more about jquery.
So everything was going well until clicking the button. I cannot find a way to return the value of what button was pressed so I can take further action within the function.
As an exercise, for the past few days I've been attempting to build a simple search and return data to a page.
The form parses vars to PHP with no refresh PHP gets stuff from the database PHP echos an array Array is output using Jquery in my #result div
Things seem to be working nicely, and the array is indeed coming out the other end.
My next aim was to be able to do something with the output. The first step I assumed would involve printing that array to a table. It's this that I'm having trouble with. I can't figure out the syntax.
With regards to the following code, I think the success function on line 32 and 33 should be something like:
$.each(something something) more something's with TD's and TR's interspersed
The code I have so far is as follows. This successfully echos out the contents of the array, but ultimately isn't useful without being able to access the elements.
i happen to chase my fortunes in development as a newcomer. Scenario,// using jqm-rc2, sample registration - ajax callback scenario
1. Say formtoregister.phpcalls a studentsregister.php // Ajax/json and POST 2. Thisstudentsregister.phpdoes this 2.1 validates POST data, does db work and 2.2 sends back to formtoregister.php following messages //on success echo json_encode($promoinfo);// json format, see below the echoed content echo "<p>Welcome $user </p>" problem,is plain format text is printed Message is: {promo code: JsonNAjax}<p>Welcome Beginner </p>
I am using getJSON to get results from a different domain and i wantedto get _some_ object back when calling getJSON so that i can insertsome variables into the callback scope.Basically, what i wanted to do was this:
var new_json = $.getJSON(url, function(data) { alert (this.variable_from_caller);
I have a jQuery script which shows a specified div based on the select chosen from the dropdown list.The problem im having is how to retain the div state after the page has been posted and then returned too,