Добавление нового класса
Если я пропишу
<head> <script src=\"/css/lib/jquery.min.js\"></script> <script src=\"/css/lib/jquery.jcarousel.js\"></script> <style type=\"text/css\"> .nullPadding { margin-top: 0px; margin-bottom: 0px; } </style> <script type=\"text/javascript\"> jQuery(document).ready( jQuery('p').addClass('nullPadding')); </script> </head> (это, разумеется, не всё, что есть в хэде; двойные кавычки экранированы для cms) это правильный код? Вносимые изменения будут отображаться в коде страницы? И еще вопрос, можно как-то прописать, чтобы добавлялся не класс, а в тег <p> напрямую вносились стили? <p style='margin-top: 0px; margin-bottom: 0px;'> ? |
<script type=\"text/javascript\"> $(document).ready(function(){ jQuery('p').addClass('nullPadding') }); </script> |
|
То есть так, верно?
<script type=\"text/javascript\"> jQuery(document).ready(function(){ jQuery('div.article p').css('margin-top: 0px; margin-bottom: 0px; padding: 0px;') </script> |
<script type=\"text/javascript\"> jQuery(document).ready(function(){ jQuery('div.article p').css({ 'margin-top' : '0px', 'margin-bottom': '0px', 'padding' : '0px;' //Последний без запятой }); }); </script> |
Точка с запятой у последнего пункта таки лишняя.
Спасибо! |
Часовой пояс GMT +3, время: 01:15. |