We present a measurement of the direct CP-violating charge asymmetry in B(±) mesons decaying to J/ψK(±) and J/ψπ(±) where J/ψ decays to μ(+) μ(-), using the full run II data set of 10.4 fb(-1) of proton-antiproton collisions collected using the D0 detector at the Fermilab Tevatron Collider. A difference in the yield of B(-) and B(+) mesons in these decays is found by fitting to the difference between their reconstructed invariant mass distributions resulting in asymmetries of A(J/ψK) = [0.59 ± 0.37]%, which is the most precise measurement to date, and A(J/ψπ) = [-4.2 ± 4.5]%. Both measurements are consistent with standard model predictions.