The trial court did not abuse its discretion in deeming plaintiffs the prevailing parties, entitled to an attorney fee award under Civ. Code 5975(c). Plaintiffs sued their homeowners association, claiming it had not complied with the CC&Rs’ requirement for homeowner approval in connection with its plan to erect a traffic light at the gate immediately adjacent to plaintiffs’ property. After the trial court issued a preliminary injunction against the light project, the association obtained the required approval by a majority of homeowners. At that point, the trial court dissolved the preliminary injunction, and plaintiffs later dismissed their suit voluntarily. The trial court properly characterized plaintiffs’ main objective in the suit as requiring compliance with the CC&Rs, not preventing the traffic lights. Plaintiffs achieved their litigation objective when issuance of the preliminary injunction induced the association to comply with the CC&Rs. Since plaintiffs achieved their litigation objective, it did not matter that they later dismissed the suit voluntarily or that the association was thereby entitled to an award of ordinary court costs.