JSON response with object ref
Hello, I am using jQuery 1.4 to call an ajax action that returns a JSON response with the following structure. { "errors": [ { "type": xyz.AjaxActionErrorType.UKNOWN_OPERATION, "msg": "Uknown ajax operation." }], "source": "xyz.web.action.util.GisAjaxAction" } The xyz.AjaxActionErrorType.UKNOWN_OPERATION is a JavaScript object that is defined and should be available on the page that calls the ajax action - at least I can dump the object in the console log prior to invoking $.ajax and
Calling Browser Plugin Object on true condition
Hi, I am using this Browser Plugin call: world = new MTSPlugin( '../obj/main.mtx', '100%', '100%', '', 'simple', ''); in the middle of my page, where I want to load this object. (It is a 3d rendering modul Viewpoint Player) Now I want to add a browser check, as this plugin runs only in IE. When I dedect that the page is loaded with IE, I am writing via Jquery a class name into my body tag. I thought, it would work if I do the following: if($('body').attr('class').length > 1){ world = new MTSPlugin(
how json data causes parse error?
following is the data which causes parse error. {"passenger":{"isFixed":false,"name":'报销票',"tickets":[{"v":0.5,"t":65},{"v":1.0,"t":66},{"v":1.5,"t":67},{"v":2.0,"t":68},{"v":2.5,"t":69},{"v":3.0,"t":70},{"v":3.5,"t":71},{"v":4.0,"t":72},{"v":4.5,"t":73},{"v":5.0,"t":74},{"v":5.5,"t":75},{"v":6.0,"t":76},{"v":6.5,"t":77},{"v":7.0,"t":78},{"v":7.5,"t":79},{"v":8.0,"t":80},{"v":8.5,"t":81},{"v":9.0,"t":82},{"v":9.5,"t":83},{"v":10.0,"t":84},{"v":10.5,"t":85},{"v":11.0,"t":86},{"v":11.5,"t":87},{"v":12.0,"t":88},{"v":12.5,"t":89},{"v":13.0,"t":90},{"v":13.5,"t":91},{"v":14.0,"t":92},{"v":14.5,"t":93},{"v":15.0,"t":94},{"v":15.5,"t":95},{"v":16.0,"t":96},{"v":16.5,"t":97},{"v":17.0,"t":98},{"v":17.5,"t":99},{"v":18.0,"t":100},{"v":18.5,"t":101},{"v":19.0,"t":102},{"v":19.5,"t":103},{"v":20.0,"t":104}],"batches":[{"batchNo":'720',"startNo":1043501,"endNo":1043600,"minNo":1043530},{"batchNo":'757',"startNo":4225001,"endNo":4225100,"minNo":4225041}]},"claim":{"isFixed":true,"name":'客票',"items":[{"val":'1.0',"tid":37,"batches":[{"batchNo":'628',"startNo":20751,"endNo":21000,"minNo":20882}]},{"val":'2.0',"tid":38,"batches":[{"batchNo":'803',"startNo":1,"endNo":500,"minNo":174}]},{"val":'3.0',"tid":39,"batches":[{"batchNo":'762',"startNo":2501,"endNo":3000,"minNo":2759}]},{"val":'4.0',"tid":40,"batches":[{"batchNo":'691',"startNo":3501,"endNo":4000,"minNo":3855}]},{"val":'5.0',"tid":41,"batches":[{"batchNo":'804',"startNo":18001,"endNo":18500,"minNo":18030}]},{"val":'6.0',"tid":42,"batches":[{"batchNo":'805',"startNo":38951,"endNo":39450,"minNo":39026}]},{"val":'7.0',"tid":43,"batches":[{"batchNo":'859',"startNo":31501,"endNo":32000,"minNo":31530}]},{"val":'8.0',"tid":44,"batches":[{"batchNo":'12',"startNo":11933,"endNo":12000,"minNo":11971},{"batchNo":'430',"startNo":1028,"endNo":1500,"minNo":1028}]},{"val":'9.0',"tid":45,"batches":[{"batchNo":'692',"startNo":184001,"endNo":184498,"minNo":184437},{"batchNo":'998',"startNo":159501,"endNo":160000,"minNo":159501}]}]}}
How to achieve accurately unequal column heights
I use the equal heights plugin with no problem to get two divs to be the same height. For a current design I need one column to be exactly 95px shorter than a second (variable height) column at all times. Any good way to achieve this? Thanks
How to set jquery banners?
I have defined jQuery.extend(Drupal.settings, and like to see banner. How to add correct code to do this (images, javascript)?
Don't collapse a list on page load
I've made a animated collapsable list using this script. But now I want to keep one submenu expanded, I have the ID of the ul that must be kept expanded. So after everything is collapsed my script checks the ID of every submenu and compares it to the given ID. If the ID of the submenu is equal to the given ID, the submenu should expand. Should, because that doesn't. Here's the code: for(var i = 0; i < $('li:has(ul)').length; i++) { if ($('li:has(ul)')[i].id == givenid) { $('li:has(ul)')[i].children().toggle('slow')
get attribute value from table row
hi.. I need to access a couple attribute values from a table when a button is clicked and I'm not sure how to access this information.. for instance.. <tbody> <tr firstAttr='something' secondAttr='something'> <td></td>.... </tr> <tr firstAttr='something' secondAttr='something'> <td></td>.... </tr> </tbody> when a button is clicked I need to grab those attribute values ..help?!?
access table row attributes
I need to access two attribute values I've assigned to each row in my table when a button is clicked.. I'm not sure how to access the attributes.. <tbody> <tr attr1='something" attr2='somethingElse'> <td></td>.... </tr> <tr attr1='something" attr2='somethingElse'> <td></td>.... </tr> </tbody I tried something like this... but I really don't know function ExportToPbuse() { var rowCount = GeneralReport.rows.length; for (var i = 0; i < rowCount; i++) { var userId = $(this).attr("userid")
How to manipulate pseudo selectors :after and :before
I have the impression $('h1:after') e.g. doesn't work. How to manipulate these pseudo selectors with jQuery? Thank you
.select & .focus within an eventhandler (firefox)
Hi Folks, I know there are some issues trying to use .focus() and .select() within another eventhandler (for the same object) in firefox. What I don't know is, howto workaround?
Why intro.js is accepting parameter called undefined?
intro.js (function( window, undefined ) { outro.js window.jQuery = window.$ = jQuery; })(window); Why intro.js is accepting two parameters when only one parameter is being passed?
Read querystring from javascript file src=?
Hello, Is it possible to read quertystring of the javascript file called? For example <script src="test.js?param=1"></script> Anyway to get param1? Thanks!
Why is this expression giving me a syntax error?
Hi, I'm trying to match an input with an id ending in "dlNum". I have this expression ... $( "input[ @id $= 'dlNum' ]" ).val(licenseNumber); but on Mac 10.5.6 Firefox (latest version), I'm getting this error: uncaught exception: Syntax error, unrecognized expression: [ @id $= 'dlNum' ] What is the correct syntax to use to match an id ending in an expression? Thanks, - Dave
Validate at least one phone number & the numbers themselves?
Hi have a form with three fields for home phone, work phone & mobile phone. I've got jquery to validate that the numbers entered are the right format, i.e. using the following with custom methods for the phoneUK etc. x_HomeTel: {required: true, phoneUK: true}, x_WorkTel: {required: true, workUK: true }, x_MobileTel: {required: true, mobileUK: true }, The thing is I only need one of these numbers. I have been trying *all day* to try and get this to work but no joy. I know I need to group them somehow
Get a web contents from other website
I have simple web contents in a page on one server, foo.bar.org and want to plant that in a page on a second server, bar.org This code doesn't work: $(function(){ $("#test").load("http://foo.bar.org/test.shtml"); }); although it does work if I put test.shtml on the second server, bar.org, and refer to it relative to root. Can someone please tell me how to get it from foo.bar.org? thanks! CC
how to change selection
Hi everybody, I am new at this forum, so please forgive my mistakes ;-) I would like to change selection of <select id='id_select'> <option value=1>Position 1</option> <option selected="selected" value=2>Position 2</option> <option value=3>Position 3</option> <option value=4>Position 4</option> <option value=5>Position 5</option> </select> to this for example: <select id='id_select'> <option value=1>Position 1</option> <option value=2>Position 2</option> <option value=3>Position
hiding multiple divs
Hey I need some help with some javascripting. {foreach key=num item=account from=$accounts} <div id="info"> <div class="box round"> <table cellspacing="1" class="data"> <tr onclick="javascript: $('#info').hide('fast'); $('#{$account.id}details').slideDown('slow');" style="cursor:pointer;"> <td>{$account.regdate}</td> <td>{$account.product}<br /><a href="http://{$account.domain}" target="_blank">{$account.domain}</a></td> <td>{$account.nextduedate}</td><td>{$currencysymbol}{$account.amount} {$currency}</td>
visibility vs display
Hi, Why it is not possible to use visibility instead of display to hide element before FX ? Because if you want to use display: inline-block or other value than block, it's not works. And if you want to "reserve" space for the element, only visibility can do that. Thanks.
jQuery Select and Drag elements with relative and absolute position problem
Hi, I had askedthis question on another forum but unfortunately I was unable to find a fix. I have a select and drag code that works well until in selection is added a position relative div. Here is the code and you can see a working demo at http://jsbin.com/azeli/2 To see the problem just mouse select span 1, span 2 and the nested span 4 You can see the code and demo at http://jsbin.com/azeli/2 $(function() { var selected = $([]), offset = {top:0, left:0}; $("#selectable1").selectable();
Fade In Row Background Color on Checkbox
I want to make the row backgroud color fade in from bright yellow to white (or another color) when a user clicks the checkbox. I tried several options but cannot figure it out. <form name="f"> <table id="Table" border="1"><tr> <td width="20"><input type="checkbox" name="cb1" id="cb1" value="y" /></td> <td width="596">Click me</td> </tr><tr> <td><input type="checkbox" name="cb2" id="cb2" value="y" /></td> <td>Click me</td> </tr><tr> <td><input type="checkbox" name="cb3" id="cb3"
AutoComplete speed
Hi, I have been using jQuery specifically AutoComplete however I need some advice as at times it is a bit slow: 1. The autocomplete process calls a php file and returns Towns/Counties(States) as the user types. 2. This PHP file then calls another php file relating to the correct Alphabetic (starting) character of the word (eg: A calls AClass, B calls BClass etc.) 3. The data in each class is in an array relating to the first two letters of the Town/County (eg: A has a number of Arrays for Town/Counties
how stopping this scroll?
Hi, I'm working with this script to do an ul scroll. I don't know exactly how many li will do, but firstly I read the length and then I match this length to my ul. By two buttons (prev and next) the animation go ahead and back, but when the li are finished the button is still active and the scroll go ahead. How can I stop it and remove the button? totWidth = $(".img-slide li").size() * 100; // get ul total width $(".img-slide").css("width", totWidth); // set ul total width marginMax = 400
Replicate an Ajax.ActionLink in jquery?
Im wondering how to replicate the action link below in jquery? And if I want this ajax action to trigger after the page loads where is the best place to put it? in the onLoad() event? <%= Ajax.ActionLink("Search More", "searchMoreSystems", "search", new { searchID = anySearchID }, new AjaxOptions { UpdateTargetId = "moreResults" })%>"
2 divs in one jquery function
<script type="text/javascript"> jQuery(document).ready(function() { jQuery('#slider-container').cycle ({ fx: 'fade', speed: 'fast', timeout: 6000, pause:2, next: '#featured-next', prev: '#featured-prev' }); }) </script>That is the jquery I'm using. Is it possible to add two div IDs?
Passing value from function to other function selector
Hi all, I have issue with passin value between functions: $(document).ready(function(){ id = 'test'; $('#Meno').keyup(function(){ id = '#Mobil'; }); $(id).click(function(){ console.log(id); }); }); I am getting from console.log right value "#Mobil" but $(id) has value "Test". I need there also value "#Mobil". Any idea what I am doing wrong?
Basic Problem: using .hover and .click together for two different animations
There has to be a simple solution for this. I want to animate a button with .hover and then animate it even more with .click. The problem is when the button is clicked, the mouse is no longer hovered so the hover returns to the default position. I need to stop the .hover from returning to the default non-hover state when the button is clicked. Any ideas? Hover Code: $('#about-btn').hover(function () { $('#about-btn').stop().animate({ marginLeft : 27
Browser's history
Hello, I have a page /songs where you navigate through ajax pagination links. So imagin you have seen some pages of the songs listings and you are on page 40. You browse to another page in the site. Let's say /about. Now if I press back from my browser I want to navigate to the 40th page of /song. Is this possible? I know I can put in the url something like #page=40. but if I press the back button the no javascript is ran, right? EDIT: for example. In google reader if you click on an RSS from the
adding css property
I don't know if this is the right place to ask this but i'm trying to figure out what is happening and knocking my head on the wall for it. I'm using jquery to add the "hover" effect in IE6. so this is my html <div id="header_glbl" > <ul> <li class="top_btn_left"><a href="index.php">Κεντρική</a></li> <li class="top_btn"><a></a></li> <li class="top_btn"><a></a></li> <li class="top_btn"><a></a></li> <li class="top_btn"><a></a></li> <li class="top_btn"><a></a></li> <li class="top_btn"><a></a></li> <li
Passing value from function to other function as selector value
Hi all, I have problem with following script: $(document).ready(function(){ id = 'test'; $('#Name').keyup(function(){ id = '#Mobil'; }); $(id).click(function(){ console.log(id); }); });Console.log has right value "#Mobil" but $(id) is using value "Test". I need there value "#Mobil" like console.log has. Thx for help.
animation menu
Ok i have this problem i made the menu button- id="m1" and when i hover over then a submenu with buttons( submenu image id = "pag" and submenu button id="buttons") to come from the left and increase its size : as how my i want my menu to look you can see here : http://www.utah.travel/ here my code: $(document).ready(function () { $("#m1").hover(function(){ $("#pag").stop().animate( {width:"450px"}, {duration:500}) $('#buttons').show("normal"); },function(){ $("#pag").stop().animate(
How to show ajax indicator for nested ajax call?
I have made an ajax indicator and registered it to the global ajax event: $("<div></div>") .attr('id', 'ajaxLoader') .text('Loading...') .appendTo("body") .bgIframe() .bind("ajaxSend", function(ev){ console.log("ajaxSend"); $(this).show(); }) .bind("ajaxComplete", function(ev){ console.log('ajaxComplete'); $(this).hide(); }); Then I have an ajax request like (using validation and ajaxForm plugin): $("#form").validate({ submitHandler: function(){ $("#form").ajaxSubmit({ success: function(response,
Events bound with live() run several times.
Hi, I'm currently building an application which loads in a page via a $.post() call after a link is clicked. The returned data is then placed inside an element (div) via .html(); The problem i'm facing is the page I bring in contains some markup and some javascript similar to below; $(document).ready(function() { $("#button").live("click", function() { // does something }); }); The problem i'm facing is that the loaded in page runs fine the first time i click on the link to load it in but if
code OK in Firefox but fails in IE
I have what I thought was a simple piece of code to count characters in a text area. The code works fine in FF and safari, but not in IE. Can someone explain if the problem is my code or something else. $("textarea#content").keyup(function() { var len = this.value.length; if (len >= 300) { this.value = this.value.substring(0, 300); } $("p#CountDown").html("You have used " + this.value.length + " of 300 characters"); });
load() not working on some requests in IE8
I can't figure a problem I'm having in IE. The same thing works in Chrome. Look at this URL and click on one of the small images next to the sneaker. This works fine. The itemWrapper div is replaced correctly and looks great. http://be.ksbedard.com/jgasite/product.aspx?id=101791 Then try this URL and click on one of the small images next the album cover. http://be.ksbedard.com/jgasite/product.aspx?id=161416 Everything seems to work ok in jQuery from what I can tell, the response shows success.
display flickr for a moment and return to size different that expected using slideUp, slideDown, Hide, Show
Hi. i am using jQuery UI1.7.2. and jQuery 1.3.2 <script type="text/javascript"> $(document).ready(function() { // hides the slickbox as soon as the DOM is ready // (a little sooner than page load) $('#homepage_alerts').hide(); // shows the slickbox on clicking the noted link $('#slick-show').click(function() { $('#homepage_alerts').slideDown(500); return false; }); // hides the slickbox on clicking the noted
Is there a way to test confirm message?
I am trying to write a test for following method. $('#clickme').live('click', function() { if (confirm('Are you sure?')) { doSomething(); } return false; }); I was wondering how to test confirm method. Is there a way to override confirm method. If not then I was thinking of moving the confirm method to a different method and then I should mock that method to return true or false depending on test case. Just want to know what others do in such cases to test a method.
show() / hide() problem in ie6
please view http://www.chronicler.co.cc/ using firefox.. using ie6, it does not render the correct format... can anyone help? thanks
AJAX response to DOM traversing problem
Hey guys, I'm trying to do an AJAX call and convert the response (which is a HTML document) into DOM, so I can traverse it via .find() I've successfully done it before using jQuery 1.2.6, but the following example code doesn't seem to work in 1.4.1 for me anymore: alert($('<div class="message_confirm"><p>Hello</p></div>').find('div.message_confirm').html());That piece of code, IMHO, should come up with a "<p>Hello</p>" message, am I correct? However, instead, it comes up with "null". Anyone can spot
Variables as objects.
I was hoping you guys could help clear something up for me. function get_states(country_element,state_element) { countryElementIDHash = "#" + country_element; stateElementIDHash = "#" + state_element; $(stateElementIDHash).empty(); var geonameId = $(countryElementIDHash).val(); $.getJSON("http://ws.geonames.org/childrenJSON?&callback=?", { 'geonameId': geonameId }, function(data) { if (data.geonames
How can i get the title of the url
Hello, How can i get the page title and page description of the url using jQuery?
Next Page