For example, if you want to have button which will clear content from text box, but you don't want to loose focus from your text box then you can use this code: 

<!DOCTYPE html>
<html>

	<head>
	</head>

	<body>

		<input type="text" placeholder="Your text" id="myText">
		<button>Test</button>
		
		<script type="text/javascript" src="/jquery-2.1.3.js"></script>
		<script type="text/javascript" src="/index.js"></script>

	</body>

</html>

JS:

$("#myText").focus(function (event) {
	alert("Focus!");
});

$("button").mousedown(function( event ) {
	event.preventDefault();
	$("#myText").val("");
});

Thing to notice:

event.preventDefault();

Example you can see here.

Or here: