سؤال

I have the following snippet..

<script type='text/javascript'>
fieldSettings["text"] += ", .my_label_setting";

//binding to the load field settings event to initialize the checkbox
jQuery(document).bind("gform_load_field_settings", function(event, field, form){
jQuery("#my_label_placeholder").val(field["mylabel"]);          
});
</script>

This is working great, but what I want to do now is specify a bit more. I want it to only run the first line if fieldSettings["text"] but is not also fieldSettings["my_custom_field"]

It is part of gravityforms code but I don't think thats relevant.

Can anyone help? Is it just a standard if statement i need?

هل كانت مفيدة؟

المحلول

I think you have a bit of confusion. jQuery is a javascript library. You are still programming in javascript, so just use a javascript if-statement.

if (fieldSettings["text"] != fieldSettings["my_custom_field"]) { //or whatever
   // do whatever
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top