<div id="block_msg" style="width:250px;border: solid 1px red;margin: 15px">
<div id="text_msg1">111текст111</div>
<input type="submit" onclick="clickon(**<<<HERE I WANT SEE DIV ID TEXT_MSG1>>>**)" value="Добавить">
</div>
How can I get id="text_msg1" and put it into onclick? How?
thisis the current object, you can than look at the parent and find the divs. This solution is hacky since changing the layout means it will break.and
JSFiddle
It would be better to have a class on the div and look for that class.