Search Results

Search found 4827 results on 194 pages for 'alert'.

Page 36/194 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • jquery - detect if selector returns null

    - by peirix
    What is the best way to detect if a jQuery-selector returns an empty object. If you do: alert($('#notAnElement')); you get [object Object], so the way I do it now is: alert($('#notAnElement').get(0)); which will write "undefined", and so you can do a check for that. But it seems very bad. What other way is there?

    Read the article

  • jQuery 1.4.2 and IE6: change event not firing first time using keyboard

    - by macca1
    I've done a good amount of research on this and found a bunch of reported problems and solutions but the general consensus seems that all change problems in IE6 were fixed in jQuery 1.4.2. I'm having an issue where a change event is not firing in jQuery 1.4.2, but it did fire successfully in jQuery 1.3.2. This is in IE6. I'm about to submit a bug for this, but for my sanity I wanted to post it here first to see if there's something dumb I'm missing. I don't understand why this is working this way... <HTML> <HEAD> <TITLE>jQuery 1.4.2 Problem </TITLE> <script src="jquery-1.4.2.min.js" type="text/javascript"></script> <script> $(document).ready( function() { $("#firstBox").change(function() { alert("CHANGE"); }); // ONLOAD of document autofocus into the first element... $("form").find(":input:visible:first").focus() }); </script> </HEAD> <BODY> <form> <select id="firstBox"> <option value="" selected="selected">--</option> <option value="1">One</option> <option value="2">Two</option> </select> <br><br> <input size="10" id="secondBox"> </form> </BODY> </HTML> Simple enough, right? Onload of the page, give the first element focus. Onchange of the first element, alert. If you use the mouse, it works as expected. The page loads, the focus is in the drop down, you change the option, you get the alert. The problem is if you use the keyboard. The page loads, the focus is in the drop down, you press the down arrow. The option changes. Tab off the field, no alert. Weird. To make it even weirder, if you tab back into the field and change it again (all using the keyboard), the change event DOES fire after tab out this time. Any ideas?

    Read the article

  • Mistake in the Code

    - by vibha
    myTree.on('click',function(node){ if(node.isLeaf()) { Ext.Msg.alert("You are in value ",nodeValue,"whose name is",nodeName); alert("You are in value ",nodeValue,"whose name is",nodeName); } }); myTree is a TreePanel. I'm getting a tree but click function is not working. I'm very new to extjs. Help me out. Thanks in advance

    Read the article

  • overriding previously-bound click events

    - by JamesBrownIsDead
    When I use this code with an element whose id is "foobar": $("#foobar").click(function () { alert("first"); }); $("#foobar").click(function () { alert("second"); }); I get two alerts: "first" and "second" second. How do I specify a click event that also clears out any previous click events attached to the element? I want the last $("#foobar").click(...) to erase any previously bound events.

    Read the article

  • Sanity Check: change event not firing first time using keyboard

    - by macca1
    I've done a good amount of research on this and found a bunch of reported problems and solutions but the general consensus seems that all change problems in IE6 were fixed in jQuery 1.4.2. I'm having an issue where a change event is not firing in jQuery 1.4.2, but it did fire successfully in jQuery 1.3.2. This is in IE6. I'm about to submit a bug for this, but for my sanity I wanted to post it here first to see if there's something dumb I'm missing. I don't understand why this is working this way... <HTML> <HEAD> <TITLE>jQuery 1.4.2 Problem </TITLE> <script src="jquery-1.4.2.min.js" type="text/javascript"></script> <script> $(document).ready( function() { $("#firstBox").change(function() { alert("CHANGE"); }); // ONLOAD of document autofocus into the first element... $("form").find(":input:visible:first").focus() }); </script> </HEAD> <BODY> <form> <select id="firstBox"> <option value="" selected="selected">--</option> <option value="1">One</option> <option value="2">Two</option> </select> <br><br> <input size="10" id="secondBox"> </form> </BODY> </HTML> Simple enough, right? Onload of the page, give the first element focus. Onchange of the first element, alert. If you use the mouse, it works as expected. The page loads, the focus is in the drop down, you change the option, you get the alert. The problem is if you use the keyboard. The page loads, the focus is in the drop down, you press the down arrow. The option changes. Tab off the field, no alert. Weird. To make it even weirder, if you tab back into the field and change it again (all using the keyboard), the change event DOES fire after tab out this time. Any ideas?

    Read the article

  • Why GLatLng() doesn't receive variables?

    - by David
    Hi, i have the following code to update a google map: function updateit(c1,c2){ alert(c1+"-"+c2); // This works map.setCenter(new GLatLng(c1, c2), 13); // But this doesn't } updateit(37.4419, -122.1419); The alert is working and show the two coordinations, but i think the GLatLng() doesn't receive them, so the map is not updated unless i directly declare them as strings : function updateit(c1,c2){ map.setCenter(new GLatLng(37.4419, -122.1419), 13); // This works } How to fix this problem? Thanks

    Read the article

  • How to use jQuery to make a call to HttpHandler to get return value

    - by aspdotnetuser
    I want to use jQuery to make a call to a c# web service called c.ashx which checks whether that username is valid and returns an error message as a string. What should I put for data: and content type: if the return value of the c# webservice is a string value? jQuery.ajax({ type: "GET", url: "/services/CheckUserName.ashx", data: "", contenttype: "", success: function (msg) { alert("success"); }, error: function (msg, text) { alert(text); } });

    Read the article

  • Ajax success function firing before java class responds

    - by user1899281
    I am creating a login function with ajax and am having an issue where the success function (SuccessLogin) fires before getting an ajax response. I am running the code as google web app from eclipse and I can see when debugging the java class file, that the javascript is throwing an alert for the success response from the class being false before the debugger catches the break point in the class file. I have only been writing code for a couple months now so I am sure its a stupid little error on my part. $(document).ready(function() { sessionChecker() // sign in $('#signInForm').click(function () { $().button('loading') var email = $('#user_username').val(); sessionStorage.email = $('#user_username').val(); var password= $('#user_password').val(); var SignInRequest = { type: "UserLoginRequest", email: email, password: password } var data= JSON.stringify(SignInRequest); //disabled all the text fields $('.text').attr('disabled','true'); //start the ajax $.ajax({ url: "/resources/user/login", type: "POST", data: data, cache: false, success: successLogin(data) }); }); //if submit button is clicked $('#Register').click(function () { $().button('loading') var email = $('#email').val(); if ($('#InputPassword').val()== $('#ConfirmPassword').val()) { var password= $('input[id=InputPassword]').val(); } else {alert("Passwords do not match"); return ;} var UserRegistrationRequest = { type: "UserRegistrationRequest", email: email, password: password } var data= JSON.stringify(UserRegistrationRequest); //disabled all the text fields $('.text').attr('disabled','true'); //start the ajax $.ajax({ url: "/resources/user/register", type: "POST", data: data, cache: false, success: function (data) { if (data.success==true) { //hide the form $('form').fadeOut('slow'); //show the success message $('.done').fadeIn('slow'); } else alert('data.errorReason'); } }); return false; }); }); function successLogin (data){ if (data.success) { sessionStorage.userID= data.userID var userID = data.userID sessionChecker(userID); } else alert(data.errorReason); } //session check function sessionChecker(uid) { if (sessionStorage.userID!= null){ var userID = sessionStorage.userID }; if (userID != null){ $('#user').append(userID) $('#fat-menu_1').fadeOut('slow') $('#fat-menu_2').append(sessionStorage.email).fadeIn('slow') }; }

    Read the article

  • having json issues..getting this in firebug--missing ] after element list

    - by faizal
    hi all this is my json object..everything seems to be fin e but dunnkow why i am seeing this--missing ] after element list can somebody help.,.here is y json {"rows": [{"type": "fft_vel","axis": "x","pwrhgh": 7.44475138121547E-02,"pwrlow": 2.35267034990792E-02,"hzlow": 244.827586206897,"hzhgh": 506.896551724138,"dataid": 0,"id": 467,"name": "2008-02-08 14:24:22 - creating first active alarms testing","title": "RMS displacement alert on Pump 11 Sensor 2","description": "An RMS displacement value of 0.04495 inches was recorded on Pump 11 Sensor 2 on 2\u002F8\u002F2008. This is between the RMS displacement alert levels of 0.0442 inches and 0.12 inches.","time_stamp": "2\u002F8\u002F2008 2:24:22 PM","sensor_id": 550003281}]}

    Read the article

  • issues with live function

    - by Do Good
    I am using the .live function to fire of a function aaa(). Unable to fire the function because code does not reach alert msg The structure of my html is body id="plants" form id= flower method="post" div class= "rose" div class= "red" ul id = "colors" li a li a li a Cuurently I am using $( 'body#plants form#flower div.rose div.red ul#colors li a' ).live('click', function(){ alert('code reaches'); aaa(); }); How can I get this to work?

    Read the article

  • Using javascript to detect browser type

    - by Duber
    I'm trying to use this line to detect browser type: IE or Firefox. alert(isBrowser("Microsoft")); but I get absolutely nothing, the alert doesn't even pop up. Not sure what I'm doing wrong. What would be the best practice way to detect browser type?

    Read the article

  • jquery javascript question

    - by mckenzie
    Hello, var val = $("#desc").val(); // input box var val2 = $("#type").val(); // select box if((val=='') || (val2 == '')) { alert("err"); } else { // codes } when i select dropdown and not type anything on inputbox, the alert err still comes out? how to make it when dropdown is selected, it goes to else clause?

    Read the article

  • jQuery resize not working at FireFox, Chrome and Safari

    - by naveen
    $("#dvMyDIV").bind("resize", function(){ alert("Resized"); }); or $("#dvMyDIV").resize(function(){ alert("Resized"); }); The questions Why is this not working at FireFox, Chrome and Safari? Can this be considered a jQuery bug since the resize is not handled for other browsers? Could the only workaround be calling a SetTimeout function checking the clientHeight and clientWidth? Any workarounds using jQuery?

    Read the article

  • How to bind to localStorage change event using jQuery for all browsers?

    - by David Glenn
    How do I bind a function to the HTML5 localStorage change event using jQuery? $(function () { $(window).bind('storage', function (e) { alert('storage changed'); }); localStorage.setItem('a', 'test'); }); I've tried the above but the alert is not showing. Update: It works in Firefox 3.6 but it doesn't work in Chrome 8 or IE 8 so the question should be more 'How to bind to localStorage change event using jQuery for all browsers?'

    Read the article

  • jQuery is not filtering/selecting on IE after ajax call

    - by VinTem
    I have the following code that works on firefox and chrome $("#adicionarItem").click(function(){ $.ajax({ type: 'GET', url: $("#formAdicionaItem").attr("action"), data: $("#formAdicionaItem").serialize(), success: function(response){ alert($("div#errors", response).size()); } }); }); In IE the alert always returns zero. In firefox/chrome it returns 1 wich is the expected value. Does anyone know if this is a bug or if I am doing something wrong?

    Read the article

  • Why doesn't $("#RadioButtons:checked").val() work in IE?

    - by Randy Heaps
    Why doesn't $("#RadioButtons:checked").val() - id selector - work in Internet Explorer but $("input:radio[name='RadioButtons']:checked").val() - name selector - does? <input name="RadioButtons" id="RadioButtons" type="radio" value="1" checked> <input name="RadioButtons" id="RadioButtons" type="radio" value="2"> <script> alert($("#RadioButtons:checked").val()); alert($("input:radio[name='RadioButtons']:checked").val()); </script>

    Read the article

  • How to use jQuery to make a call to c# webservice to get return value

    - by aspdotnetuser
    I want to use jQuery to make a call to a c# web service called c.ashx which checks whether that username is valid and returns an error message as a string. What should I put for data: and content type: if the return value of the c# webservice is a string value? jQuery.ajax({ type: "GET", url: "/services/CheckUserName.ashx", data: "", contenttype: "", success: function (msg) { alert("success"); }, error: function (msg, text) { alert(text); } });

    Read the article

  • How to not over-use jQuery?

    - by Fedyashev Nikita
    Typical jQuery over-use: $('button').click(function() { alert('Button clicked: ' + $(this).attr('id')); }); Which can be simplified to: $('button').click(function() { alert('Button clicked: ' + this.id); }); Which is way faster. Can you give me any more examples of similar jQuery over-use?

    Read the article

  • Cannot render javascript from controller

    - by Ermin
    I want to display a modal window with an error message, when the user has entered something invalid in a form, but render another action if everything is ok. However, when I try to display the modal window with render :js => "jQuery.facebox(#{...})" only the actual javascript called is displayed: try { jQuery.facebox(...) } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('jQuery.facebox(\"<div class=\'error\'>Error</div>\")'); throw e }

    Read the article

  • Unsure how to design JavaScript / jQuery functionality which uses XML to create HTML objects

    - by Jack Roscoe
    Hi, I'm using JavScript and jQuery to read an XML document and subsequently use the information from the XML to create HTML objects. The main 'C' nodes in the XML document all have a type attribute, and depending on the type I want to run a function which will create a new html object using the other attributes assigned to that particular 'C' node node. Currently, I have a for loop which extracts each 'C' node from the XML and also it's attributes (e.g. width, height, x, y). Also inside the for loop, I have an if statement which checks the 'type' attribute of the current 'C' node being processed, and depending on the type it will run a different function which will then create a new HTML object with the attributes which have been drawn from the XML. The problem is that there may be more than one 'C' node of the same type, so for example when I'm creating the function that will run when a 'C' node of 'type=1' is detected, I cannot use the 'var p = document.createElement('p')' because if a 'C' node of the same type comes up later in the loop it will clash and override that element with that variable that has just been created. I'm not really sure how to approach this? Here is my entire script. If you need me to elaborate on any parts please ask, I'm sure it's not written in the nicest possible way: var arrayIds = new Array(); $(document).ready(function(){ $.ajax({ type: "GET", url: "question.xml", dataType: "xml", success: function(xml) { $(xml).find("C").each(function(){ arrayIds.push($(this).attr('ID')); }); var svgTag = document.createElement('SVG'); // Create question type objects function ctyp3(x,y,width,height,baC) { alert('test'); var r = document.createElement('rect'); r.x = x; r.y = y; r.width = width; r.height = height; r.fillcolor = baC; svgTag.appendChild(r); } // Extract question data from XML var questions = []; for (j=0; j<arrayIds.length; j++) { $(xml).find("C[ID='" + arrayIds[j] + "']").each(function(){ // pass values questions[j] = { typ: $(this).attr('typ'), width: $(this).find("I").attr('wid'), height: $(this).find("I").attr('hei'), x: $(this).find("I").attr('x'), y: $(this).find("I").attr('x'), baC: $(this).find("I").attr('baC'), boC: $(this).find("I").attr('boC'), boW: $(this).find("I").attr('boW') } alert($(this).attr('typ')); if ($(this).attr('typ') == '3') { ctyp3(x,y,width,height,baC); // alert('pass'); } else { // Add here // alert('fail'); } }); } } }); });

    Read the article

  • jQuery AJAX with multiple URLs

    - by Fernando Valente
    I'm using jQuery to load the images before displaying them. The problem is that I don't know how many images are going to be loaded. The page loads the image paths from a XML file. I'm using this: $.ajax({ url: 'images/BYLINE/1.png', dataType: "image/png", success: function(data) { alert('psil'); }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } });

    Read the article

  • Jquery StopPropagation not working in firefox

    - by Karim Mortabit
    I have this code working on Safari and Chrome , but not in Firefox . Is firefox having a problem with StopPropagation() ? $(function() { // Setup drop down menu $('.dropdown-toggle').dropdown(); // Fix input element click problem $('.login-menu form').click(function(e) { alert( e.isPropagationStopped() ); e.stopPropagation(); alert( e.isPropagationStopped() ); }); });

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >