User1868852945 posted
I have an href with an onclick window.open which opens the next page:
<a href='#' onclick='window.open(connect_url("@item.object_name","@item.capture_date","@item.capture_id"), "_blank")'>@item.object_name</a>
I want to add logic that compares two variables where the next page will only open when they are equal. If they are not equal I do not want the open to occur (nothing will happen).
I tried adding the compare logic in bold font below which does not compile. Can someone please advise on how to do this? How can I effectively cancel the href? Thanks.
<a href='#' onclick='window.open(if (var1 == var2) {connect_url("@item.object_name","@item.capture_date","@item.capture_id")}, "_blank")'>@item.object_name</a>