Using JQuery to toggle a widget

Discussion in 'PHP' started by Remo, Sep 10, 2009.

  1. #1
    Hello Guys

    And Im hoping someone can help me with this (as driving me nuts)as I know its not overly complicated but im not a coder but can work my around code

    background - Wordpress

    Trying to achieve - toggle a widget

    Scenario - I am using a widget called TDO Min Forms but my questions applies quite generally to any widget

    What im ultimately trying to achieve by clicking on a link is to do a Jquery link so click the link and the widget drops down/open up so user does not leave page

    I have the widget and this would apply to any widget essentially click to expand/un hide, eg "click to expand" or similar

    You have no idea how much I will appreciate anyones help on this

    As a side note if you havent used it before TDO mini forms much as driving me crazy has lots of possibilities and if I was the author nope I would not have questions about it :) but trust me its cool

    Hopefully someone can help

    Thanks in advance
    Remo
     
    Remo, Sep 10, 2009 IP
  2. morehawes

    morehawes Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi, this is posted in the PHP forum. You might be best of posting in the Javascript forum.

    Joe.
     
    morehawes, Sep 11, 2009 IP
  3. dweebsonduty

    dweebsonduty Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    Digital Goods:
    1
    #3
    What you have to do is to find out where the html is coming from within the widget.

    Than you can do something like this:
    
    <head>
    <script type="text/JavaScript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
    
    <script type="text/JavaScript">
    function showtheform()
    {
    $("#showform").html("THIS IS WHERE THE HTML FROM THE FORM SHOULD GO);
    }
    </script>
    
    </head>
    <body>
    <a href="javascript:void" onclick="showtheform()">Show Form</a>
    <div id="showform"></div>
    
    
    Code (markup):
     
    dweebsonduty, Sep 12, 2009 IP