0
اضافه کردن تگ a,img در یک div بکمکjquery
سلام
یک تگ div داریم می خواهم و وقتی روی button کردم کد زیر داخلش نمایش داده شود
<a href="@Url.Action("Retrieve", "Home",new{Area="test", id = list.PersonId})" > <img src="@Url.Action("Retrieve", "Home",new{Area="test", id = list.PersonId})" alt="فاقد عکس میباشد" style="width: 100px; height: 100px;" class="rounded " /> </a>
نمیدوم چطوری بنویسم کدرا
1 پاسخ
0
سلام اینو تست کنید
<script> function appendText() { var txt1 = "<a href='@Url.Action('Retrieve', 'Home',new{Area='test', id = list.PersonId})' > <img src = '@Url.Action('Retrieve ', 'Home ',new{Area=' test ', id = list.PersonId})' alt='image not found' style = 'width: 100px; height: 100px;' class = 'rounded ' / > </a>"; $("#addcode").append(txt1); // Append new elements } </script> </head> <body> <button onclick="appendText()">Append text</button> <div id="addcode" style="background-color:#ccc;"></div> </body>