0

I have a div that I load in with the jQuery 'load'. Is it possible to update a parent variable from within the loaded div?

i.e. parent var - var testvar = 55

and from with in the loaded div I set testvar = 33

now when the loaded div is closed, testvar is now = 33?


edit - example code: (I actually have two loads deep)

$(".bgBtn").click(function(){       
   $('#dialogLoad').show().load('../dialog/backgroundPicker.php');
})

inside the loaded #dialogLoad div:

var test = 44;

$(".newBgBtn").click(function(){        
   $('#bgs').load('../dialog/backgroundPicker2.php');
})

inside loaded #bgs div:

$(".button").click(function(){      
   test = 33;
})

Now the original var test is == 33

Chris
  • 833
  • 2
  • 17
  • 37

1 Answers1

0

Try using .parent() in jquery. Find more here on jquery official site

UPDATE:

    $('#yourChildID').parent().val();
Abubakkar
  • 15,488
  • 8
  • 55
  • 83