SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member doni's Avatar
    Join Date
    Apr 2012
    Location
    TN
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    On change not working in chrome

    I have the following code which works fine in fire fox but in chrome it will hide the div but when i choose free it doesnt show it again, any ideas?

    Code:
                                        <label for="ax_type"> Type</label>
                                        <select name="type" id="type">
                                            <option value="free">Free</option>
                                            <option value="premium">Premium</option>
                                        </select>
                                
                                        <script type="text/javascript">
                                            jQuery(function($) {
                                                
                                                $('#ax_type').change(function(){
                                                    if ( $(this).val() == "free" ) {
                                                        $('.submit_right').show();
                                                    } else {
                                                        $('.submit_right').hide();
                                                    }
                                                });
                                                 
                                            });                                            
                                        </script>

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    ax_type refers to the label element, whereas it is the select element that you need to use instead.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member doni's Avatar
    Join Date
    Apr 2012
    Location
    TN
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I knew I was missing something simple. Thanks


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
  •