A search for invisible decays of Higgs bosons is performed using the vector boson fusion and associated ZH production modes. In the ZH mode, the Z boson is required to decay to a pair of charged leptons or a bb quark pair. The searches use the 8TeV pp collision dataset collected by the CMS detector at the LHC, corresponding to an integrated luminosity of up to 19.7 fb(-1). Certain channels include data from 7TeV collisions corresponding to an integrated luminosity of 4.9 fb(-1).The searches are sensitive to non-standardmodel invisible decays of the recently observed Higgs boson, as well as additional Higgs bosons with similar production modes and large invisible branching fractions. In all channels, the observed data are consistent with the expected standard model backgrounds. Limits are set on the production cross section times invisible branching fraction, as a function of the Higgs boson mass, for the vector boson fusion and ZH production modes. By combining all channels, and assuming standard model Higgs boson cross sections and acceptances, the observed (expected) upper limit on the invisible branching fraction at m(H) = 125GeV is found to be 0.58 (0.44) at 95% confidence level. We interpret this limit in terms of a Higgs-portal model of dark matter interactions.