Javascript-форум (https://javascript.ru/forum/)
-   Javascript под браузер (https://javascript.ru/forum/css-html/)
-   -   Как заменить код (https://javascript.ru/forum/css-html/65636-kak-zamenit-kod.html)

gepavlik 31.10.2016 00:19

Как заменить код
 
Всем доброго времени суток помогите пожалуйста с кодом javascript
Нужно мне поменять с помощью скрипта данную строку

<textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid #c1c1c1; margin: 10px 25px; padding: 0px; resize: none; display: none; "></textarea>
заменить на эту
<textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid #c1c1c1; margin: 10px 25px; padding: 0px; resize: none; "></textarea>
как сделать не пойму помогите!!!!!

Aetae 31.10.2016 01:24

Именно строку, или таки элемент?
Если строку:
text.replace(
    '<textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid #c1c1c1; margin: 10px 25px; padding: 0px; resize: none; display: none; "></textarea>',
    '<textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid #c1c1c1; margin: 10px 25px; padding: 0px; resize: none; "></textarea>'
);
Логично, неправда-ли?

Если всё же нужен элемент на странице, то:
document.getElementById('g-recaptcha-response').style.removeProperty('display');

gepavlik 31.10.2016 01:35

Aetae,
Спасибо огромное
document.getElementById('g-recaptcha-response').style.removeProperty('display');

Подошло супер


Часовой пояс GMT +3, время: 07:38.