i have a page that has a hidden iframe in it.
inside this hidden iframe i load a large html file which basically contain a bunch of div. Each div is a page of an account creation wizard. I plan to show and hide different div from within iframe to be show to use. this kind of simulates a pop up.
here is what is strange. See code below, the code below is part of the iframe.
id=accmgr_fin_inst_search is a search button inside this div
id=accmgr_fin_inst is a text input field user type in something and click on the search button (which is above id)
the click even register and works fine (i know because of the alert("ifram is"))
however when the code reaches var fin_inst = $('#accmgr_fin_inst').val();
fin_inst is undefined? both dom element with id of accmgr_fin_inst and accmgr_fin_inst_search are on the same page. How can the button click get register but retrieving the value from #accmgr_fin_inst i get an undefined?
i got it to work if i used var fin_inst = $('#accmgr_fin_inst', parent.document).val(); instead. Which is strange? i want something consistent. why is it that the button click doesn't need "parent.document" while the value retrival does? any idea?
jQuery(function($) {
$('#accmgr_fin_inst_search').click(function(e) {
e.preventDefault();
$this = $(this);
alert("ifram js");
var fin_inst = $('#accmgr_fin_inst').val();