jquery

jQuery getJSON - Return value to the caller function

String.prototype.getLanguage = function() { $.getJSON('http://ajax.googleapis.com/ajax/services/language/detect?v=1.0&q=' + this + '&callback=?', function(json) { return json.responseData.language; }); }; How can I return the value to the caller value? Thanks. EDIT: I've tried...

how to find the selected value and text of multiple select boxes and add them to hidden fields.

Hi everyone,I've been stuck with this problem for sometime now, I just don't seem to find a way to fix it.I'd really appreciate it if someone could help me. I have multiple select boxes on 1 page, I need to get the text of the select boxes(which is the qty of an item) and the value of the selectboxes (the price of the item) and the item...

How to get serverside information into javascript?

Hi, I don't know how to ask this question that's why I'm going to simulate what I need, some developers make what I need by rendering javascript with php. A simple sample file would look like: my_javascript_file.php <?php include "my_class.php"; ?> $(document).ready(function(){ $.ajax({ url: "<?php $my_obj->post_url(); ?>...

How can I erase all inline styles with javascript and leave only the styles specified in the css style sheet?

If I have the following in my html: <div style="height:300px; width:300px; background-color:#ffffff;"></div> And this in my css style sheet: div { width:100px; height:100px; background-color:#000000; } Is there any way, with javascript/jquery, to remove all of the inline styles and leave only the styles specified by the...

Still having troube with jquery Image rollovers

Ok I am still having some issues with this code below. I have received some guidance from some SO users and I appreciate that. However, I am still perplexed with what I am doing wrong here. I have a basic rollover jquery script using images. However, when the user clicks one of the images I want that image to stay in the “active/clicke...

adding return true to jquery cycle's next/previous buttons.

The jQuery code used: $('#contentspacer').cycle({fx:'fade',speed:2500,timeout:6000,next:'.next',prev:'.prev'}); $('.pause').click(function() {$('#contentspacer').cycle('pause'); return false;}); $('.play').click(function() {$('#contentspacer').cycle('resume'); return false;}); The html used for the "navigation": <div class="pnbtns"><...

JQuery Toggle Method Slow on 1000+ UL

Hello Everyone, I am working on a project where I am building a treeview and in some cases my tree could have a 1000+ child nodes. The problem is its really slow on like a IE7 machine. I'm not doing any kind of animation or anything, just simply trying to hide the next UL in the item using JQuery's toggle feature. Does anyone have an...

jQuery, how can I pass args to event handler?

How can I pass args to the event handler function? This runs the function on page load which is not the desired effect. I need this routine "validateText" to run against several different textbox, dropdown combinations. Can I reuse "validateText" instead of creating one per text/dropdown combination?? //add blur event handler to the te...

how to go through an array and add their values

I was wondering how is it possible to go through the values of an array and add their values together. var arr = [1,2,3,4]; should I use var add = $.each(arr,function() { }); but how can I add the values together. thanks ...

jQuery Selector Comparison Articles

I'm reviewing a number of jQuery functions that have various implementations of id selection. I want to try and standardise on one best-practice approach, but before I do that I want to ensure that I pick the most efficient. Does anyone have links to good articles (such as this one) that make comparisons between different types of sele...

jquery+php send values

hi , i have forms createds that require a value , as this this forms edits different users. so how would i send that value from jquery? i know how to do it with combobox , but i want to do it from links : like - name [details] when someone clicks on details the forms will pop up, so i wana mimic index.php?id=2 but with jquery, anyideas?...

troubles with jQuery mouseleave

I am trying to create a menu with this structure: <ul id="primary" class="menuOptions"> <li>Item 1</li> <li>Item 2 <div id="secondary"> <ul class="menuOptions"> <li>subItemOne</li> <li>subItemTwo</li> </ul> </div> </li> <li>Item 3</li> </ul> I a...

How to see if an element in offscreen.

I have a list of divs, and everytime I want to go to the next div I press a key. I need to check if that div is offscreen, and if so, I need to move the screen to show that div either using anchors or another method. What is my best option for doing this? Just to clairify, offscreen in my case means something that can't be seen right n...

clone table row, append random or sequential number to ID

So i have this code $('input.clone').live('click', function(){ //put jquery this context into a var var $btn = $(this); //use .closest() to navigate from the buttno to the closest row and clone it var $clonedRow = $btn.closest('tr').clone(); //append the cloned row to end of the table //clean ids if you need to $cl...

jquery prevent default does not work

I want to change image when user click on a thumb image, and prevent it to jump to the top of page. the first code I wrote: $('#photos-list img').click(function(e) { e.preventDefault(); var imgObj = new Image(); var targetObj = $('#main_image img'); imgObj.onload = function() { targetObj.attr('src',this.src); } imgObj.src = $...

How to capture submit event using jQuery in an ASP.NET application?

I'm trying to handle the submit event of a form element using jQuery. $("form").bind("submit", function() { alert("You are submitting!"); }); This never fires when the form submits (as part of a postback, e.g. when I click on a button or linkbutton). Is there a way to make this work? I could attach to events of the i...

Where can I get a PHP / MYSQL chat room application

My question is an elaboration of this one: http://stackoverflow.com/questions/1093251/php-mysql-ajax-chat I have a 100 chat rooms which I need to make. Is there a php/mysql based chat system that would do something like this? phpFreeChat is mentioned, but from what I understand, I have to (manually) download and install the applicatio...

CSS Optimization: Element ID vs. Class

With MVC and jQuery I am making significantly more use of CSS. A question that came to mind is what is the best approach for using Element IDs vs. Classes. If I use Element IDs the selectors in jQuery are shorter. For example: #imageTag... $('#imageTag') #searchTag... $('#searchTag') As an alternative it could be structured with a par...

jQuery: Transform slideshow from one DIV to many DIVs

I'm writing some rather basic jQuery code to create a slideshow from a set of images in a DIV. The CSS ensures that all images are stacked on top of each other. The script looks at the active image in the set, then moves the NEXT image's z-index up (via CSS class) and fades it in from 0.0 opacity. Rinse, repeat. It's actually based on so...

[jQuery] : How to highlight certain words with jQuery

Hi all, I'm looking for a script than can highlight a certain number of words depending on their position. example, for the following contentI want to highlight only the second, third and fourth words: <p> Quisque bibendum sem ut lacus. Integer dolor ullamcorper libero. Aliquam rhoncus eros at augue. Suspendisse vitae mauris. </...