updating content of tabs to show changed variables, jquery & javascript

Posted on 2011-10-20
Last Modified: 2012-05-12
once this is loaded on the site, the vars e.g. x2, sc_name will be updated,

i would like to be able to update  the whole 'tabs' element, (meaning its text shows the new vars)
without re-loading the whole page... preferably

i would be calling/triggering the refresh from an onclick event, not a timer.

from my reading jquery should be able to do it, but i have not been able to get it working.
any help / advice on doing this would be appreciated - im quite new to all this.
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title> testing </title>
    	<link type="text/css" href="jq/css/south-street/jquery-ui-1.8.16.custom.css" rel="stylesheet" media="all" /> 
    	<script type="text/javascript" src="jq/js/jquery-1.6.2.min.js"></script>   <!-- jquery -->
   		<script type="text/javascript" src="jq/js/jquery-ui-1.8.16.custom.min.js"></script>    
     <script type="text/javascript">
		//jquery tools functions.
				// Tabs
var sc_name, x2 = "origtext";			
	 $(document).ready(function() {
   $("a").click(function() {
     x2 = "fun";
     sc_name = "newstuff";


    <a href="">clickme</a>

 <div id="tabs" > <!--style="visibility:Hidden;"> -->
        <li><a href="#tab-1"><span>>Summary</span></a></li>
        <li><a href="#tab-2"><span>two</span></a></li>
        <li><a href="#tab-3">Info</span></a></li>
        <li><a href="#tab-4">Picture gallery</span></a></li>
      <div id="tab-1">
        <p>summary of the  stats</p>
		<script type="text/javascript">
		document.write("sc name:" + sc_name + "<br>");
		document.write("Number: " +x2 + "<br>");
      <div id="tab-2">
       <p>Summary & links to relevant resources</p>

      <div id="tab-3">
        <p>here will be hotdogs...</p>
       <div id="tab-4">	
		<div Id="picdiv" style="height:200px;">

		click to upload new picture...[link to upload]

Open in new window

Question by:weaverk
    LVL 81

    Accepted Solution

    Check this :
    var sc_name, x2 = "origtext";
    $(document).ready(function() {
        $("a").click(function(e) {
            x2 = "fun";
            sc_name = "newstuff";
            $("#tab-1").html("<p>summary of the  stats</p>sc name:" + sc_name + "<br>Number: " +x2 + "<br>");

    Open in new window

    LVL 1

    Author Comment

    i  made into a function so i can call the refresh on demand and it works suberbly.
    many thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
    This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
    The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now