Skip to content

Instantly share code, notes, and snippets.

@chintanop
Created October 12, 2012 14:56
Show Gist options
  • Save chintanop/3879605 to your computer and use it in GitHub Desktop.
Save chintanop/3879605 to your computer and use it in GitHub Desktop.
rule widget javascript
$(document).ready(function() {
$("#{{attrs.rule_webparam}}_li").hide();
{% ifequal attrs.init_state "visible" %}
$("#{{attrs.toggle}}_li").show();
$("#{{attrs.toggle}}_li").css("cssText","display:block !important;");
{% else %}
$("#{{attrs.toggle}}_li").hide();
$("#{{attrs.toggle}}_li").css("cssText","display:none !important;");
{% endifequal %}
$("*[name='{{attrs.field}}']").change(function(){
$("*[name='{{attrs.field}}']:checked").each(function () {
keyval = $(this).val();
elem_id = $(this).attr('id');
if (keyval == '{{attrs.target_trigger_val}}'){
$("#{{attrs.toggle}}_li").show();
$("#{{attrs.toggle}}_li").css("cssText","display:block !important;");
}else{
$("#{{attrs.toggle}}_li").hide();
}
});
}).change();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment