JS для Chrome: изменилась верстка, скрипт не работает
В скрипте есть строка:
var goods_price = parseFloat($('#patch-total-info>div.pb5:first-child span.value').html().split(" <")[0].replace(/ /g, "")); обрабатывающая ранее html в таком виде: <div class="sm-or ft-rt patch-target" id="patch-total-info"> <div class="pb5"> <span class="gray fs13">Стоимость товаров:</span> <span class="red fs14"> <span class="value">247 <span class="currency-symbol rub">Р</span></span> </span> </div> <div class="pb5"> <span class="gray fs13">Сумма скидок по заказу:</span> <span class="black fs14"> <span class="value">0 <span class="currency-symbol rub">Р</span></span> </span> </div> <div class="hide"> <span id="order-product-summ"> <span class="value">247 <span class="currency-symbol rub">Р</span></span> </span> </div> <div class="pb20"> <span class="gray fs13">Стоимость доставки:</span> <span class="black fs14" id="order-cost-price"> <span class="value" >0 <span class="currency-symbol rub">Р</span></span> </span> </div> сейчас этот же кусок html сверстан по другому: <div class="order-table-footer__right patch-target" id="patch-total-info"> <ul class="order-table-footer__list"> <li class="order-table-footer__list-item"> <p class="order-table-footer__text order-table-footer__text_muted order-table-footer__text_full">Стоимость товаров</p> <p class="order-table-footer__text order-table-footer__text_price">912 <span class="currency-symbol rub">₽</span></p> </li> <li class="order-table-footer__list-item"> <p class="order-table-footer__text order-table-footer__text_muted order-table-footer__text_full">Сумма скидок по заказу</p> <p class="order-table-footer__text order-table-footer__text_price">0 <span class="currency-symbol rub">₽</span></p> </li> <li class="order-table-footer__list-item"> <p class="order-table-footer__text order-table-footer__text_muted order-table-footer__text_full">Стоимость доставки</p> <p class="order-table-footer__text order-table-footer__text_price" id="order-cost-price"> <span class="value" >0 <span class="currency-symbol rub">₽</span></span> </p> </li> <li class="order-table-footer__list-item hide"> <p class="order-table-footer__text order-table-footer__text_muted order-table-footer__text_full">Стоимость доставки</p> <p class="order-table-footer__text order-table-footer__text_price" id="order-product-summ">912 <span class="currency-symbol rub">₽</span></p> </li> </ul> <p class="order-table-footer__total">Итого: <span id="order-total-summ">912 <span class="currency-symbol rub">₽</span></span></p> </div> Помогите исправить эту строчку js-скрипта, чтобы в переменную считывалось корректное значение. Не силен в JS, поэтому очень прошу помочь! |
Пожалуйста, отформатируйте свой код!
Для этого его можно заключить в специальные теги: js/css/html и т.п., например: [html run] ... минимальный код страницы с вашей проблемой [/html] О том, как вставить в сообщение исполняемый javascript и html-код, а также о дополнительных возможностях форматирования - читайте http://javascript.ru/formatting. |
rashhin,
:( var goods_price = parseFloat($('#patch-total-info li:first-child .order-table-footer__text_price').html().split(" <")[0].replace(/ /g, "")); |
спасибо большое, ошибка в консоли ушла.
но скрипт все равно не работает, значит чтото еще:( |
теперь такая ошибка - http://joxi.ru/GrqWRxVsz44aW2
|
Цитата:
|
код скинуть сюда?
|
Цитата:
|
да это хорошо, конечно) но сейчас не до этого...
если ошибка, скрин которой я скинул говорит о селекторах - тогда покопаю. просто в исходном хтмл верстка только в одном месте отличается. может чтото не разглядел еще. посмотрю внимательнее. спасибо. |
Часовой пояс GMT +3, время: 21:48. |