Hi all! I've been sizzling a little with the change method but I can't seem to get it to work. I have two hidden fields that gets updated by numerous links and it works fine but the function I have tired to the onchange event is never fired. Here is some code snippets from my code: $(function(){ // apply delegate to the onchange event of the hidden fields $('#hdfLocation, #hdfType').change( function(){ alert("delegates is working");g_hdfChange = true; } ) }
<script type="text/javascript" defer="defer"> // global boolean that indicate if the hidden fields has been altered var g_hdfChange = false; function SetCalendarCallProperties(location, type) { // jQuery objects of the hidden fields "hdfLocation" and "hdfType" var hdfLocation = $('#hdfLocation'); var hdfType = $('#hdfType'); // if the hidden field is not set (eg. first time this function is called) // then show the periode picker. if(!hdfLocation.val()) ShowPeriodePicker(); // if the new location and type ids are not the same as the previously one // (they will never be in the first run) // store the new location and type id in the hidden fields if(hdfLocation.val() != location) hdfLocation.val(location); if(hdfType.val() != type) hdfType.val(type); if(g_hdfChange) document.forms[0].submit(); } ... <input type="hidden" name="hdfLocation" id="hdfLocation" value="5" /> <input type="hidden" name="hdfType" id="hdfType" value="1" /> ... <li> <a class="club" href="#">NATTOGET (Slagelse)</a> <ul> <li id="li5dj"><a onclick="SetCalendarCallProperties(5, 1)" href="#">DJs</a></li> <li id="li5show"><a onclick="SetCalendarCallProperties(5, 2)" href="#">Shows</a></li> </ul> </li> <li> <a class="club" href="#">RITZ (Køge)</a> <ul> <li id="li22dj"><a onclick="SetCalendarCallProperties(22, 1)" href="#">DJs</a></li> <li id="li22show"><a onclick="SetCalendarCallProperties(22, 2)" href="#">Shows</a></li> </ul> </li> Do the onchange event apply to hidden fields? I haven't found any documentation on that. Anyway I hope this issue is not too hard to crack. Thanks in advance!
_______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/