1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Translate jQuery into Prototype

Discussion in 'Programming' started by lew1s666, Sep 8, 2015.

  1. #1
    I have a jQuery code which I need inprototype. How can I rewrite this with help of prototype ?

    <script>
    $('#select-custom-group').on('change',function(){
    if( $(this).val()==="K"){
    $(".nobr").show()
    }
    else{
    $(".nobr").hide()
    }
    });
    </script>
    Code (markup):

     
    lew1s666, Sep 8, 2015 IP
  2. paullopez

    paullopez Active Member

    Messages:
    102
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    68
    #2
    Try this...
    Prototype uses $ for id based selection.
    jQuery $ = CSS based selector (=$$ in Prototype)

    <script>
    $('select-custom-group').on('change',function(){
    if( $(this).val()==="K"){
    $(".nobr").show()
    }
    else{
    $(".nobr").hide()
    }
    });
    </script>
     
    paullopez, Sep 8, 2015 IP
  3. lew1s666

    lew1s666 Member

    Messages:
    101
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #3
    not working at all. :( any idea?
     
    lew1s666, Sep 9, 2015 IP