Looks like load() is replacing the element and clearing the event handlers that add the classes. From the jQuery API reference.
Up vote 1 down vote favorite share g+ share fb share tw.
I have what seems like an odd situation here. I'm launching dialogs from a table of data (for editing records). But when I launch the modal, my row striping (applied via js) on the table disappears and additional clicks on edit in IE produce a modal with an incorrect height.
Now, this was working fine, but as I've been tweaking my functions to do what I need, something broke it. I also have an "add" link on the same page that does not kill the table css. Below I have my striping logic and relevant dialog code.
If you need to see more, let me know. What am I missing? $(document).
Ready(function() { $(". Striped tr"). Mouseover(function() { $(this).
AddClass("highlight"); }); $(". Striped tr"). Mouseout(function() { $(this).
RemoveClass("highlight"); }); $(". Striped tr"). Click(function() { $(this).
ToggleClass("selected"); }); $(". Striped tr:nth-child(odd)"). AddClass("odd"); }); $(function() { // Dialog //alert($(this).form.val()); var rep_id = $("#rep_id"), name = $("#name"), num_name = $("#num_name"), external = $("#external"), allFields = $().
Add(rep_id). Add(name). Add(external).
Add(num_name), tips = $(". ValidateTips"); function checkLengthEdit(o, n, min, max, msg) { //alert(o. Length); if (o.
Length > max || o. Length max || o. Length AddClass("ui-state-error"); updateTips(msg); alert("failed validation"); return false; } else { alert("passed validation"); return true; } } function updateTips(t) { tips.
Text(t). AddClass("ui-state-error"); } function removeTips(t) { tips. Text(t).
RemoveClass("ui-state-error"); } $('#edit_number'). Dialog({ autoOpen: false, width: 400, modal: true, buttons: { "Update Number": function() { var bValid = true; allFields. RemoveClass('ui-state-error'); if (bValid) { alert("valid"); //document.
Edit_number_form.submit(); } }, "Cancel": function() { allFields. RemoveClass('ui-state-error'); removeTips(''); $(this). Dialog("close"); } } }); $('.
Edit_number_link'). Bind('click', function() { var edit_path = $(this). Attr("href"); $("#edit_number").
Load(edit_path). Dialog('open'); return false; }); }); Any help would be appreciated. UPDATE: Updated code posted.
It looks like it's related to .load. When I comment out the . Load, the dialog pops and css remains in the table.
Still looking to get it fixed though... jquery jquery-ui dialog modal-dialog link|improve this question edited Mar 3 '11 at 21:23polarblau5,6861720 asked Mar 2 '11 at 22:02jayhawkjoe256.
I knew I shouldn't have posted this at the end of the day. Bump? – jayhawkjoe Mar 3 '11 at 14:18 What is the intent of this line $("#edit_number").
Load(edit_path). Dialog('open');? – Sonny Mar 7 '11 at 18:29 It opens the dialog and loads the external page referenced in edit_path.
– jayhawkjoe Mar 7 '11 at 19:53.
Looks like load() is replacing the element and clearing the event handlers that add the classes. From the jQuery API reference: .load() sets the HTML contents of the matched element to the returned data. You'll need to re-bind the events to that element.
I'm not sure I know how to do that. Can you help? Am I re-binding my striping?
– jayhawkjoe Mar 7 '11 at 15:54 You should probably uncheck my answer as the solution until we actually get it working :) – Sonny Mar 7 '11 at 18:17 Didn't want to uncheck since I'm 99% sure your answer is correct, even if I don't know how to implement. But you're the boss :) – jayhawkjoe Mar 7 '11 at 19:21 Since you got in working, I wouldn't mind having my answer checked as the solution ;) – Sonny Mar 7 '11 at 14:33.
Not sure on the protocol here: I was not able to fix this problem, but got around it by using json to populate my edit form instead of loading it from an external file. @sonny, thank you for your help.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.