SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    563
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    jQuery / javascript Code working in Chrome but not in IE

    Hi,

    I have used getJSON and some other small javascript code in my page.
    Its working perfectly in Chrome but not working in IE. I have IE 10.

    Code:
    	<script type="text/javascript" charset="utf-8">
    	function checkForm()
    	{
    		if (document.f1.ctlPrice.value == "") 
    		{ 
    			alert ("Please specify Width and Drop then press Get Price button"); 
    			return (false); 
    		}
    		else { return (true); }
    	}
    
    	$(function() {
    		$('#ctlCalc').live('click', function()
    		{
    			$("#lblQuantity").hide();
    			$("#ctlItemQty").hide();
    			$("#ctlAskQues").hide();
    			$("#ctlBuyBut").hide();
    			$('#ctlPrice').val("");
    			
    			maxWidth = <?=$a1["MaxWidth"]?>;
    			maxDrop = <?=$a1["MaxDrop"]?>;
    			
    			if (ctlWidth.value > maxWidth) { alert ("Width cannot be greater than " + maxWidth); return (false); }
    			if (ctlDrop.value > maxDrop) { alert ("Drop cannot be greater than " + maxDrop); return (false); }
    			
    			$.getJSON("ajax.php",
    			{
    				pid: ctlItemID.value,
    				width: ctlWidth.value,
    				drop: ctlDrop.value
    			}, 
    			function(data){
    				if (data.price != "")
    				{
    					$("#lblQuantity").show();
    					$("#ctlItemQty").show();
    					$("#ctlBuyBut").show();
    					$("#ctlAskQues").show();
    					ctlPrice.value = data.price;
    					$("#lblPrice").html("Price: &pound;" + data.price);
    				}
    				else
    				{
    					alert ("Oops! An error occured");
    				}
    			});
    		});
    	});
    	</script>
    If i put alert("Ha"); in the code then its showing in IE but rest of the anything is not working. It means when I am clicking the ctlCalc button its firing the click and showing the alert but why anything else is not working only in IE ?

    Please help.

    Thanks.

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Have you opened the developer console in IE to check for any JavaScript errors? You can open it by hitting F12 on your keyboard then switching to the console tab.

  3. #3
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    563
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chris.upjohn View Post
    Have you opened the developer console in IE to check for any JavaScript errors? You can open it by hitting F12 on your keyboard then switching to the console tab.
    Hi,

    Thanks it helped to solve the issue.

    Thanks again.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •