нужно найти и удалить теги <a>
есть div id="tablica"
в нем html код с ссылками например: <a href="/reg/live/pay.php?obj=149&login=блаблабла&title=1">750 000 руб.</a> а мне нужно чтобы я по клику на кнопку
jQuery("#sobrat").click(function() {}
очищал теги <a> и чтобы оставался в итоге текст 750 000 руб. |
ufaclub,
<div id="table">
<a href="/reg/live/pay.php?obj=149&login=блаблабла&title=1">750 000 руб.</a>
<a href="/reg/live/pay.php?obj=149&login=блаблабла&title=1">750 000 руб.</a>
<a href="/reg/live/pay.php?obj=149&login=блаблабла&title=1">750 000 руб.</a>
</div>
<button id="button">Button</button>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
$('#button').click(function() {
var str = '';
$('#table a').each(function() {
str += $(this).text();
$(this).remove();
});
$('#table').text(str);
});
</script>
|
ufaclub,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<div id="table">
<a href="/reg/live/pay.php?obj=149&login=блаблабла&title=1">750 000 руб.</a>
<a href="/reg/live/pay.php?obj=149&login=блаблабла&title=1">150 000 руб.</a>
<a href="/reg/live/pay.php?obj=149&login=блаблабла&title=1">650 000 руб.</a>
</div>
<button id="button">Button</button>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
$('#button').click(function() {
$('#table a').replaceWith(function() {
return this.text;
});
});
</script>
</body>
</html>
|
Спасибо!
|
| Часовой пояс GMT +3, время: 08:08. |