Mouse move object along x axis

I want my object to move with the mouse only on the x-axis because the object is getting affected by another force along the y-axis. The code I currently have moves it along both.

function Update () { 

     var mousePos = Input.mousePosition; 

     var wantedPos = Camera.main.ScreenToWorldPoint (Vector3 (mousePos.x, mousePos.y, 10)); 

     transform.position = wantedPos; 


How can I have the mouse move it along the x axis without affecting what happens to the y-axis

transform.position.y = wantedPos.y;