Skip to content

Instantly share code, notes, and snippets.

@chronossc
Created April 5, 2011 19:10
Show Gist options
  • Save chronossc/904292 to your computer and use it in GitHub Desktop.
Save chronossc/904292 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
$(function(){
$("input[type!=hidden]").each(function(i,obj) {
//console.debug(i,obj)
if ($(obj).attr('id').slice(0,8) == "id_form2") {
hidden_name = $(obj).attr('name').replace('2','1')
obj_hidden = $("input[name="+hidden_name+"]") // so we get form 1 value field
$(obj).change(function(e) {
if ($(this).attr('val') != $(obj_hidden).attr('val')) {
$(this).parents("tr:first").addClass('forced');
} else {
$(this).parents("tr:first").removeClass('forced');
}
})
$(obj).change()
}
})
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment