Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Declaring variables in jquery / javascript (for ie8)

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 479
    Comment on it

    Sometime we need to perform some operations in variables values in jquery or javascript. We generally uses:

    a = jQuery('input#marks').val();
    

    It will be working fine in all the browsers except ie8. This type of assignment doesn't works in ie8.

    You need to use var before jquery / javascript variable. otherwise ie8 will not let you proceed :

    var 
    

    for this purpose before the variable name.

    for example:

    var a ='';
    a = jQuery('input#marks').val(); 
    I wasted 3 hours in finding the solution for this problem. Example 2)
    var table_val      = jQuery('#restaurant_row'+id).find('#table_name').val();
    var qty            = jQuery('#restaurant_row'+id).find('#qty').val();
    var estimatedTime  = jQuery('#restaurant_row'+id).find('#estimated_time').val();
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: