I can't figure out how to escape this particular '. I have the following code:
//Insert Home Room Teacher
$j("tr:contains('Home Room')").after('<tr><td class="bold">Home Room Teacher</td><td><input type="text" name="[01]home_room_teacher" value="" size="25"></td></tr>');
[01]home_room_teacher is a field that contains the student's home room teacher's last name. One of our teachers last name is O'Shea. As is, the code works for every other teacher fine. If I load a student who has him for their home room, the ' in his last name breaks the script and none of it loads (there are multiple things in the page fragment).
If I do name="\[01]home_room_teacher\", the page loads properly but the field is blank. I've also tried to edit the actual value in the field to show O\'Shea, but that doesn't work either.
Please help.
EDIT: Here is the full code that is being run:
<script>
$j(document).ready(function() {
//Insert Counselor
$j("tr:contains('Family rep')").before('<tr><td class="bold">Counselor</td><td><input type="text" name="[01]Counselor" value="" size="25"></td></tr>');
//Insert Home Room Teacher
$j("tr:contains('Home Room')").after('<tr><td class="bold">Home Room Teacher</td><td><input type="text" name="[01]home_room_teacher\" value="" size="25"></td></tr>');
//Insert Teacher Rec
$j("tr:contains('School Entry Grade Level')").after('<tr><td class="bold">Teacher Recs Visible</td><td><input type="checkbox" name="[01]RecDisplay" value="1"></td></tr>');
//Hide Rows
$j("tr:contains('Lunch'), tr:contains('District'), tr:contains('Current'), tr:contains('Phone'), tr:contains('Student'), tr:contains('Track')").css("display", "none");
//Swap TR with TR
$j("tr:contains('Locker Combination')").insertAfter($j("tr:contains('Locker Number')"));
//Alternate Color Rows
$j("td:even").css("background-color", "transparent");
$j("td:odd").css("background-color", "transparent");
$j("tr:even").css("background-color", "#D7EBF4");
$j("tr:odd").css("background-color", "#ffffff");
});
</script>