On-click behavior of buttons in html

Discussion in 'HTML & Website Design' started by Vincentas, Jan 11, 2013.

  1. #1
    Hi everyone,

    The problem: A css script has 5 buttons, on click of button 1 , i need to display a text on the same page in a fixed region(maybe by using frames or writing a hidden function and then doing show()).
    If second button is clicked show some other text in that region . Similarly for other buttons.
    What would be the most efficient way of doing this. (fastest loading of page).
     
    Vincentas, Jan 11, 2013 IP
  2. vchris

    vchris Greenhorn

    Messages:
    36
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #2
    I'd use jQuery, saves a lot of code. Then just have:

    $('.button-one').click(function(){
    $('.area-one').text('some text');
    });

    $('.button-two').click(function(){
    $('.area-two').text('some text');
    });
     
    vchris, Jan 11, 2013 IP
  3. Vincentas

    Vincentas Active Member

    Messages:
    102
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Thanks for help ;)
     
    Vincentas, Jan 13, 2013 IP