
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2024 08:24 AM
Hello. I read the post here but that solution is not working for me.
When my code runs, I get the "this.jQuery is defined" alert message, but still the button is not hidden.
Thoughts on what might be going wrong here? Thank you.
I want to do this because if our users answer certain questions the wrong way on a Catalog Item, we don't want them to even be able to submit it.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2024 06:10 AM
I was able to get this working finally, using a different this.jQuery() query:
function onCondition() {
if (this.jQuery){
//alert("1");
//this.jQuery("btn-primary").hide(); //Did NOT work for me. I have no elements of type "btn-primary".
//this.jQuery("#btn-primary").hide(); //Did NOT work for me. I have no elements with id "btn-primary".
//this.jQuery(".btn-primary").hide(); //Any element with class == .btn-primary. This did work for me.
this.jQuery("button[name='submit']").hide(); //Any button element where 'name' = 'submit'. Works also.
//alert("2");
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2024 10:43 AM
Hi @G24 I'm not sure what you are missing. The code works fine form me
After clicking ok on Alert message you can see Order Now button has become hidden in below image.
Refer below Catalog UI Policy which I tried on my PDI
if (jQuery) {
jQuery("#oi_order_now_button").hide();
} else {
this.jQuery("#submit-btn").hide();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2024 11:58 AM - edited ‎06-27-2024 12:08 PM
Thank you. Would something about the following configuration cause the code to NOT work?
Or could it be something in how the Order / Submit button is being searched for? Maybe my button is named or classed differently? Here is what the rendered button looks like:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2024 10:35 PM
Hi @G24 I have tried this as well and still I'm able to hide Order Now button.
Add condition to Catalog UI Policy and try to hide Order Now button conditionally. Let's check if it works on conditionally?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2024 06:11 AM
@Sid_Takali Thanks for all your help. I was able to get this working finally, using a different this.jQuery() selector. I posted the solution that worked for me. Thanks again.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2024 06:10 AM
I was able to get this working finally, using a different this.jQuery() query:
function onCondition() {
if (this.jQuery){
//alert("1");
//this.jQuery("btn-primary").hide(); //Did NOT work for me. I have no elements of type "btn-primary".
//this.jQuery("#btn-primary").hide(); //Did NOT work for me. I have no elements with id "btn-primary".
//this.jQuery(".btn-primary").hide(); //Any element with class == .btn-primary. This did work for me.
this.jQuery("button[name='submit']").hide(); //Any button element where 'name' = 'submit'. Works also.
//alert("2");
}
}