Thats not an ideal way to do. But, if it works for you, good.
Below I have modified your script to add point from the map click, but you would have to use the "markers" values can create graphics after the map has loaded.
require([ "esri/map", "esri/Graphic", "esri/symbols/SimpleMarkerSymbol",
"esri/symbols/SimpleLineSymbol", "esri/Color", "esri/geometry/Point", "dojo/domReady!"],
function (Map, Graphic, SimpleMarkerSymbol, SimpleLineSymbol, Color, Point) {
map = new Map("map", {
basemap: "osm",
center: [-122.9007, 47.0379],
zoom: 9,
scaleControl: true
});
map.on("load", function () {
map.infoWindow.resize(250, 100);
});
map.on("click", addPoint);
function addPoint(evt) {
var lat = evt.mapPoint.getLatitude();
var long = evt.mapPoint.getLongitude();
document.getElementById("ContentPlaceHolder1_txtLat").value = lat;
document.getElementById("ContentPlaceHolder1_txtLng").value = long;
var symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
new Color([255,0,0]), 1),
new Color([0,255,0,0.25]));
var pt = new Point(long, lat);
var graphic = new Graphic(pt, symbol);
map.graphics.add(graphic);
}
});
Take a look at the sample as well Add graphics to a map | ArcGIS API for JavaScript 3.20