startsWith( )


Refines a query to match items whose specified property value starts with a specified string.

The startsWith() function refines a PublicPlansQueryBuilder to only match items where the value of the specified property starts with the defined string. Matching with startsWith() is case-sensitive, so "TEXT" does not start with "tex".

You can only use startsWith() with a property whose value is a String.

Method Declaration
Copy
function startsWith(
  propertyName: string,
  string: string,
): PublicPlansQueryBuilder;
Method Parameters
propertyNamestringRequired

The property whose value will be compared with the string.

Supported property: slug


stringstringRequired

The string to look for at the beginning of the specified property value.

Returns
JavaScript
const newQuery = queryPublicPlans().startsWith("slug", "gold");
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?