замените текст привязки jQuery

Я не думаю, что существуют операторы формата для этого, но можно просто разделиться на 1 000, пока результат не между 1 и 999, и затем используйте строку формата для 2 цифр после запятой. Единица является отдельным символом (или возможно маленькая строка) в большинстве случаев, который можно сохранить в строке или выстроить и выполнить итерации через нее после того, как каждый делится.

82
задан Michel 26 October 2009 в 16:45
поделиться

3 ответа

Try

$("#link1").text()

to access the text inside your element. The # indicates you're searching by id. You aren't looking for a child element, so you don't need children(). Instead you want to access the text inside the element your jQuery function returns.

133
ответ дан 24 November 2019 в 09:06
поделиться

To reference an element by id, you need to use the # qualifier.

Try:

alert($("#link1").text());

To replace it, you could use:

$("#link1").text('New text');

The .html() function would work in this case too.

61
ответ дан 24 November 2019 в 09:06
поделиться
$('#link1').text("Replacement text");

The .text() method drops the text you pass it into the element content. Unlike using .html(), .text() implicitly ignores any embedded HTML markup, so if you need to embed some inline , , or whatever other similar elements, use .html() instead.

17
ответ дан 24 November 2019 в 09:06
поделиться
Другие вопросы по тегам:

Похожие вопросы: