• This add(var a, var b) doesn't work. Why??? So simple funciton

    <!DOCTYPE > <html> <head>     <title>Loop through an array using jQuery</title>     <script src="https://code.jquery.com/jquery-1.11.2.js"></script>     <script type="text/javascript"> $(document).ready(function () {      function myFunction( var a, var b) {   //Without var, the function works fine!!!!!!        return a + b;     }     var m=0;    $('# iknow').click(function(){            m=m+1;    var k = myFunction('king', m);    alert(k);   }); }); </script>  </head> <body>     <button id ="iknow">
  • Function not always executed when it should

    Hi guys, I'm developing a page with a background color and a color for a word that are randomly picked between nine colors when you click on a button. These two colors should never match because otherwise you wouldn't see the word. I created a function that checks if the colors match and if they do, calls the functions to choose the colors again. The problem is that it seems to work just some times. Here's a link to JSFiddle  Do you know why it doesn't work? EDIT: I managed to solve the problem increasing
  • jQuery addClass question

    This is nasty but at least I have the variables I want, yes it's the old Firfox on a MAC issue. So I know what OS and what browser is being used what I want to do now is to add some class names to the body tag. <script> $(document).ready( function() {  if OSName = "MacOS" && browserName = "Firefox" {   $('body').addClass("mac ff");  if OSName = "Windows" && browserName = "Firefox" {   $('body').addClass("win ff"); }); </script> </body> </html> as a guess I think I need to add on onLoad somehow and
  • Freezing Pages

    Hello Everyone, A site I just did in Jquery mobile starts freezing up when you click any regular text link on the page. The site is http://www.myuniversalawnings.com and you can see the site starting to get screwy right on the front page links at the bottom. Does anybody have a good solution to this? Thank you! Will
  • Problem with Jquery UI select custom menu open when Mouseover occur.

    Hi All, I am using the "selectmenu with custom avatar 16*16 images(select menu i need images)". reference link and code same in this site(http://jqueryui.com/selectmenu/#custom_render ). I have a problem in this selectmenu open when mouse over occur and closes when mouse over out. $('#people-button').on('mouseover', function() {         $('#people').selectmenu('open'); }); but it show an error like cann't call methods on selectmenu prior to initialization;attempted to call method 'open' ' add the
  • Jquery Ui problem regarding to menu select.

    Is their any function In Jquery select menu for user clicks the menu select items. My sample code here .http://plnkr.co/edit/7Z3E4UF9oosvnJaykIca?p=preview () Is their any function to call after the user select(clicks ) the menu items.
  • How to target an identifier that is not loaded into the DOM?

    With AJAX, I want to change content of a div. But this div is loaded by another Ajax Script. This content has a SELECT INPUT. To target, if i use : $(''#id_select').on('change', function(){---}); #id select isn't found. But if i use : $('#id_container').on('change', '#id_select', function(){...}); It's ok. No problem for this. But then, i have to change html data on a div, with : $('#search_modele').html(data); But #search_modele isn't found. How can i do ? Thanks a lot for saving my life :)
  • tablesorter - can it sort using alternating rows?

    Standard HTML table. But the output is weird: a dozen columns of data on a row then the row immediately after it is a colspan of all those columns which contains a random amount of text, but  attached to that row. How can I sort on any of those dozen columns yet maintain the following row still attached to the sorted row? Example is hard to enter but imagine a table of 3 columns like this: [table] [tr] [td]data1[/td] [td]col2[/td] [td]col3[/td] [/tr] [tr] [td colspan=3]long amount of text here[/td]
  • Make child DIV larger than parent DIV with jQuery

    Hi, This has been a discussion that I have found all over the web with no solutions yet, but I refuse to believe that its impossible, especially with using a bit of jquery magic :) The problem: I want to make the Child Div of a fix width Parent 100% width, like so: I know that with CSS this is partially achievable: .child-div{ position: absolute; left: 0; right: 0; } .parent-div{ position: static; max-width: 900px; } But the issue I'm having is that I can't actually change the position: static; prooperty
  • Wrong count is also accepting in Jquery and accepting keywords any where

    Requirement: textbox limit: 25characters, max limit:40char allow  IF text contains {State},count for {State} only is 16,  {City} count 14, {St}=2,{Zip}=5   Problem: I have written JQuery code for this (below code) but it accepts 1.25chars={City}123456789—correct 2.25charcters=1234567891245678{City}-wrong- but it also accepting this one 3.25-chareacters=123456789123456789{City}---wrong- but it also accepting this one     1 dropdown:MainContent_ddlSelectAdLine Options: HeadLine   1 Textbox: MainContent_txtAdline
  • This easy animation doesn't work?

    http://jsfiddle.net/jsfiddle135/2g138o5m/2/ What I want is: 1) Each time a user clicks $(#fly).click, the related div shall go up. 2) Then it shall set its css to the original position. Why doesn't this work?
  • How to simplify code and how animate an element inside a another element

    Hi guys, I'm new here and I'm learning jQuery. I have this piece of code: $('#portfolio ul li').mouseenter(function(){         $('.overlay', this).stop().animate({             opacity: '0.5'         }, 250, 'easeInOutQuint');         $('.overview', this).stop().animate({             top: '50%',             left: '50%',             margin: '-50 0 0 -125'         }, 250, 'easeInOutQuint');         $('.link', this).stop().animate({             bottom: '50%',             right: '50%',             margin:
  • Issue on Ordering - Indexing Multidimensional Array

    Can you please take a look at This demo let me know how I can force Javascript to push the items into the array based on the items id? <!-- begin snippet: js hide: false --> <!-- language: lang-js -->     var theArray = [         ["A", "B", "C"],         ["D", "E"],         ["F", "G", "H", "I"],         ["J"],         ["K", "L", "M"]     ];     var res = theArray.toString();     $('#textarea').text(res);     $("input[name='m1']").change(function () {         if ($(this).is(':checked')) {        
  • Reposition Div text when div is scrolled based on the visisble viewport of the div

    Is it possible to reposition the text inside a div which has scroll and recalculate the the position of the text based on the visible section . eg: the  text needs to appear 100px; from left or text -align:left but once the div scroll the text doesn't move.I have tried using the within viewport plugin of jquery  and reposition with css("left","100px") ;
  • JQuery/JavaScript syntax error while dynamic binding

    Syntax error while binding the dynamic table along with JavaScript function call <p id="dashboard">     I’m trying to bind table dynamically along with JavaScript function call <p id="dashboard">   <script> // some code Loop{ Table = Table + "<tr class='TRCol'><td class='TDColHead'><a onclick='openBasicDialog('"+ itemValue +"');'>" + itemValue + "</a></td>"; } // some code Table = Table + "</table>";          $("#dashboard").replaceWith(Table);    </script>   In browser it’s rendering with syntax
  • Running a Function When AJAX Finishes

    I am using some jQuery code to resize images client-side and send them to Amazon S3 via jQuery File Upload (https://github.com/blueimp/jQuery-File-Upload/): I want to first upload a one size file to S3, get the url back then upload the same photo again in thumbnail size. I am using Ruby on Rails (the 'get' is getting presigned credentials via controller action from S3) .  My knowledge of javascript is not very strong so please correct my terminology or point to my a how-to for what I am missing.
  • facebook like_box not working

    hey guys i am trying to add the facebook likebox on my page and nothing is appearing on my page . now what i did was followed the exact same instructions as given in the facebook screen shot seem below: but nothing appears in the browser . i went through a few online tutorials too but nothing seems to help . now as it stands my code looks as follows : <div id="fb-root"></div>          <script>(function(d, s, id) {            var js, fjs = d.getElementsByTagName(s)[0];            if (d.getElementById(id))
  • selectMenu() not working on dynamically generated HTML select

    So I have a table with a bunch of selects and I apply selectMenu to them and they work great.   Then I have an option for the user to dynamically insert an additional row, so I have a javascript function that inserts a new html row with cells and an HTML select inside one of the cells.  Then I execute the following javascript to transform the new select into the selectMenu version.   $('#dailyblock' + weekdayid + '-' + scheduleid + '-' + childid).selectmenu({               style:'popup',        
  • Having a problem with jQuery when displaying error message.

    Hey guys, I am having a problem with displaying an error message in form validation, specifically line 68. I am trying to take my var errorMessage and do a function that displays both error messages. any ideas? code is this:<!doctype html> <html> <head>   <title>test</title>   <meta name="description" content="Colin Portfolio">   <meta name="author" content="SitePoint">   <meta charset="utf-8"> <script type="text/javascript" src="jquery.min.js"></script> <link rel="stylesheet" href="mystyle.css"
  • Stuck... have a question...

    /////////////////////////// // Enter your info below// ///////////////////////// var channelName = 'thedallascowboyshow'; var vidWidth = 500; var vidHeight = 400; var maxResults = 10; var key = 'TEST KEY'; ////////////////////////////// // NO edit below this line // //////////////////////////// $(document).ready (function(){ $.get (   "https://www.googleapis.com/youtube/v3/channels",{   part: 'contentDetails',   forUsername: channelName,   key: key},   function(data){   $.each(data.items, function(i,
  • Download CSV file through ajax post

    Hi there, I'm just trying to download a file generated from PHP with ajax. Even if I set headers PHP and contentType in Ajax parameters, I have still an issue as I can't have my response in a file but in my callback success as a parameter. NB: I must send a lot of data with ajax, so I have to use POST method. My PHP code : <?php header('Content-type: text/csv'); header('Content-disposition: attachment;filename="' . $csvFilename . '"'); echo $csvContent; return; ?> My JS: $.ajax({       url: url,
  • Pass controls as attributes to jquery funtions

    How can I pass a control as a function attribute? In my case I would like to pass txtDirections and charStatus. Thanks $(document).ready( function () { $( '.txtDirections' ).keyup( function () { var maxLength = 1000; var textlength = this .value.length; if (textlength >= maxLength) { $( '#charStatus' ).html( 'You cannot write more then ' + maxLength + ' characters!' ); this .value = this .value.substring(0, maxLength); e.preventDefault(); } else { $( '#charStatus' ).html( 'You have ' + (maxLength
  • How to Delete Row using jquery Ajax

    How to Delete Row using Id    var row = $(this).closest('tr');             $.ajax({                 url: "/Course/Delete",                type: "POST",                 ajaxasync: true,                 data: {Id:1},                  ///Manually provided                 success: function () {                                                           row.remove();                    location.reload();                     alert("success");                 },                 error: function (xhr, ajaxOptions,
  • change the bg color of a container div class depending on a value of child class

    For the below codes, i want the bg color to be changed  1) to yellow for the class ms-acal-item if <a>Pending.... 2) to red for the class ms-acal-item   if <a>Rejected.... 3) to green for the class ms-acal-item  if <a>Accepted.... how do i achieve it, please help <div class="ms-acal-item"> <div class="ms-acal-sdiv"> <div class="ms-acal-title"> <a>Pending - Loren Ipsum1 </a> </div> </div> </div> <div class="ms-acal-item"> <div class="ms-acal-sdiv"> <div class="ms-acal-title"> <a>Approved - Loren Ipsum2
  • dynamic list with null value in jquery

    I've a function to make a dynamic list. $sel = $('<select id="Addlst">').appendTo($td); $.each(TableStruct[post].Liste, function (ind, value) { $('<option ' + (ind == 0 ? 'selected="selected "' : "") + ' value="' + value + '">').html(ind).appendTo($sel); }); I use value is a nullable(of integer) VB.net side. In 99.9% of cases, I've no problem. But when I've null value (it's for ranking product) My root is null in DataBase. Then when I ask $('#Addlst').val(); ... I've "null". Someone can help me?
  • app not connecting to external link

    I  developed an app which works well in the simulator and on device, but when submitted to google play app store , my app could not reference jQuery mobile/jQuery link as well as  linking to external pages and sites. Could it be a problem on the Google. This is my first app and have just been 3 weeks. Thanks
  • jQM scrolling back to the top on an initial page load?

    I have a mobile web page. I am using jQuery Mobile. I have a conditional section of server side code that will produce the following section of code: <script type="text/javascript"> $(document).ready(function () { var hole = "Hole" + @NextHole; // NextHole is just a server value var divToGoTo = document.getElementById(hole); divToGoTo.scrollIntoView(true); return false; }) </script> I've also tried this with no luck: var hole = "#Hole" + @NextHole;   $('html, body').animate({       scrollTop: $(hole).offset().top
  • menu slide down

    hi to all.. i face a problem to show menu in down of my image... this is i tried link.. http://jsfiddle.net/harithareddy/k43v14nr/
  • Where should I put my slider on page?

    This is how my page is looking. Slider works, but my main menu doesn't. What is causing the conflict and how do I resolve it? Thanks <!DOCTYPE html> <html> <head> <meta charset="utf-8">  <title>jQuery Mobile page</title>   <meta charset="utf-8" />   <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" href="css/jquery.mobile.icons.min.css"> <link rel="stylesheet" type="text/css" href="css/royalcolours.min.css"> <link rel="stylesheet" type="text/css"
  • Looping by setInterval

    http://jsfiddle.net/jsfiddle135/gbh5ejjv/ If I press time_up button, each apple array moves up every 3 second. It's difficult to find out clues. Best regards,
  • Adding Dynamically ?

    Im trying to add a newly created dynamic div to the page without reloading the page. The code is --> $.post('sampleInsert.php',function(data){   if(data.value){   alert('Inserted');   location.reload();  //Instead of reloading the page is there anyway adding without reload?   }else{   alert(data.Message);   }   },'json'); If i append the value what should i append (data ?) . var html = '';     $.post('sampleload.php',function(data){         $.each(data, function( index, value){   var divid = value.ItemID;
  • how to add tooltip for date in datepicker?

    Please!  Need Help...  How to add tool tip for select days in my project http://jsfiddle.net/hszt7tr2/  Thanks!
  • datapicker special dates selectibel false or true

    Hello!  can please explain to me how to add false and true if I wont to specila date can't be selceted (no clicible) or second option how to make other date except specila dates dates no selectible... http://jsfiddle.net/sickworm/atkaqsww/  Thanks
  • Floating popup window any recoomendation plugin?

    Hi Friends I have a Database System, and need click a button and show a floating window, in this window i want put 2 string fields and 2 buttons ADD and Cancel.   when user click on ADD buton I want send the data to a sever (with JSP).   Thanks.   Appreciate your help.  
  • .text() resulting in redundant text

    So i'm trying to implement an edit comments functionality : There's a p tag. I click on it and change the comment on it and click on a button . On the button click i'm trying to get the newly edited text. But it gives a result where in the old text is appended to the newly edited text .
  • .animate() in ASP.NET MVC not working on every page, any ideas?

    I am using .animate on the master layout page of an MVC application. All javascript and the divs it manipulates are in the _layout.cshtml page.... the animation works flawlessly on the home page, but if the page is changed, the .animate bits won't work but the .removeClass/.addClass/.html still work. I initially though it was a binding issue, so I unbound all the event handlers on a redirect and rebound them on page load.....still doesn't work. Does anyone have any ideas? jQuery $(".navbar-brand").click(function () {             var windowWidth = $(window).width();             if (windowWidth > 500) {                 var width = $(".sidePanel").width();                 width = width * -1;                 if ($(".sidePanel").hasClass('active')) {                     $(".sidePanel").removeClass('active');                     $(function () {                         $(".sidePanel").animate({                             left: width                         }, 500);                         $(".container").animate({                             left: width,                             width: windowWidth                         }, { duration: 500, queue: false });                     });                
  • When the page loads the first time the links don't work

    Hi I have the following code with Jquery, and when the fee the first time in the browser and I click on the links do not work but if I click several times all goes well, this happens. The first time when I clic on the link "Move me" you can see in the page: Resultado = filaX.undefined and nothing happen but the second time whe I clic on the link work fine This is the code: <html>  <head>     <link rel="stylesheet" href="css/bootstrap.min.css">     <!-- Optional theme -->     <link rel="stylesheet"
  • How to have 2 accordions in the same page

    I'm trying to use the accordion in the left and right column of a landin gpage. i've attached the code. i've already tried to modify the XSL for the rightcolumn and change the uid of myhrlinks to myhrlinks2. but it still doesnt work. :( help?
  • jquery.validate multipage demo not accessible for screen readers.

    It seems that the multi-page demo removes all screenreader cues.  It seems to use the label tag incorrectly and there is no 'required' added to the input field.     Can the multi-page demo be easily updated to be accessible to screen readers?  The non multi-page demo seems better except that it removes the default browser functionality that displays an error as the user moves away from a particular field. Thanks Nancy Johnson
  • IOS 8 Validatior enable is not defined

    Hi, We have a ASP.Net web application its mobile version is built using jQuery mobile (jquery.mobile-1.0.js). Recently we faced a issue like for iPhone 6 users and for iPhone 5 users who upgraded to IOS8 version we are getting error like 'Validator Enable is not defined.'  in particular page. In rest all the devices (android, iPhone4) our application works fine. Any pointers will be helpful.  We have a self calling function in the page  <script type="text/javascript"> //<![CDATA[ (function ($) {
  • Next Page

  • Announcements

  • The Basics of jQuery AJAX

    A step-by-step tutorial for those new to jQuery and wanting to use AJAX in their projects. Includes valuable information about troubleshooting using the console and understanding the request / response. http://jayblanchard.net/basics_of_jquery_ajax.html
  • jQuery Conference 2010: Boston Announcement

      The jQuery Project is very excited to announce the jQuery Conference 2010: Boston on October 16-17, 2010.  The conference will be held at the Hilton Boston Logan in Boston, Massachusetts.  The best part of this announcement is that Tickets are on sale now!  This venue is the largest that the project has worked with to date (Harvard Law School in ‘07, the MIT Stata Center in ‘08 and Microsoft New England Research Center in ‘09) and we expect to sell out very quickly. A brief synopsis of some of