A method is disclosed for fastening an electronic unit (1) to a nappy (10), said method comprising the steps of fastening the sensor element to the surface of the nappy, leaving a contact area (7) of the sensor element free from being fastened directly to the surface of the nappy, placing a first part (3) of the electronic unit between the contact area and the surface of the nappy, and placing a second part (2) of the electronic unit in close contact with a second side of the contact area opposite the first side thereof, so that the contact area of the sensor element is wedged in between the first and the second part of the electronic unit, whereby the electronic unit is attached to and held in a fixed position in relation to the sensor element. Furthermore, a sensor element and an electronic unit for being used in such a method are disclosed.