Release Sale! Save up to 50% off!

html element not working as i would hope

platinum602
2 Posts
platinum602 posted this 14 April 2023
Ask a Question

hello, i recently purchased nicepage and am using the most recent desktop version on windows 11.

i am attempting to use the html element to create a date range picker.

I have used the Site Settings and Page Settings to add Additional Head HTML and CSS as follows and in the attached file.
Additional Head Html is:

CSS is:

the CSS does not ever show up in the rendered html page (by nicepage) but the javascript does.

in fact, when i add the CSS to the Page Settings...it is never saved and disappears from the Page Settings when it is revisited.
It does stay put in the Site Settings CSS...but is not rendered in the html output of nicepage.

How I am attempting to create the daterange picker within Nicepage:

I add the javascript links in the Additional Head HTML in the Site and or the Page Settings (have tried all options)
I add the CSS in the Site and or Page Settings (have tried all options).

In the HTML block on the page I have been inserting:

<i class="fa fa-calendar"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i>

$(function() {

var start = moment().subtract(29, 'days');
var end = moment();
function cb(start, end) {
    $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
}
$('#reportrange').daterangepicker({
    startDate: start,
    endDate: end,
    ranges: {
       'Today': [moment(), moment()],
       'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
       'Last 7 Days': [moment().subtract(6, 'days'), moment()],
       'Last 30 Days': [moment().subtract(29, 'days'), moment()],
       'This Month': [moment().startOf('month'), moment().endOf('month')],
       'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
    }
}, cb);
cb(start, end);

});

And I get nothing.

I haven't figured this out, have done plenty of variations and googled about regarding nicepage and html element.

When I create a singular html page the date-range-picker works just fine using the following URL:
https://airpinky.com/picker.html

thank you for your quick response.
best
pat

hello, i recently purchased nicepage and am using the most recent desktop version on windows 11. i am attempting to use the html element to create a date range picker. I have used the Site Settings and Page Settings to add Additional Head HTML and CSS as follows **and in the attached file.** Additional Head Html is: CSS is: the CSS does not ever show up in the rendered html page (by nicepage) but the javascript does. in fact, when i add the CSS to the Page Settings...it is never saved and disappears from the Page Settings when it is revisited. It does stay put in the Site Settings CSS...but is not rendered in the html output of nicepage. How I am attempting to create the daterange picker within Nicepage: I add the javascript links in the Additional Head HTML in the Site and or the Page Settings (have tried all options) I add the CSS in the Site and or Page Settings (have tried all options). In the HTML block on the page I have been inserting: <i class="fa fa-calendar"></i>&nbsp; <span></span> <i class="fa fa-caret-down"></i> $(function() { var start = moment().subtract(29, 'days'); var end = moment(); function cb(start, end) { $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); } $('#reportrange').daterangepicker({ startDate: start, endDate: end, ranges: { 'Today': [moment(), moment()], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Last 7 Days': [moment().subtract(6, 'days'), moment()], 'Last 30 Days': [moment().subtract(29, 'days'), moment()], 'This Month': [moment().startOf('month'), moment().endOf('month')], 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] } }, cb); cb(start, end); }); And I get nothing. I haven't figured this out, have done plenty of variations and googled about regarding nicepage and html element. When I create a singular html page the date-range-picker works just fine using the following URL: https://airpinky.com/picker.html thank you for your quick response. best pat
Vote to pay developers attention to this features or issue.
3 Replies
Order By: Standard | Newest
Support Team
Support Team posted this 14 April 2023

Hello,

Please try a bit modified code in the HTML element:

<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js" defer=""></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>


<div id="reportrange" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
    <i class="fa fa-calendar"></i>&nbsp;
    <span></span> <i class="fa fa-caret-down"></i>
</div>

<script type="text/javascript">
window.addEventListener('load',function(){
jQuery(function($) {

    var start = moment().subtract(29, 'days');
    var end = moment();

    function cb(start, end) {
        $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
    }

    $('#reportrange').daterangepicker({
        startDate: start,
        endDate: end,
        ranges: {
           'Today': [moment(), moment()],
           'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
           'Last 7 Days': [moment().subtract(6, 'days'), moment()],
           'Last 30 Days': [moment().subtract(29, 'days'), moment()],
           'This Month': [moment().startOf('month'), moment().endOf('month')],
           'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
        }
    }, cb);

    cb(start, end);

});
});
</script>

It should work better.

...................................................
Sincerely,
Olivia
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hello, Please try a bit modified code in the HTML element: <script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script> <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js" defer=""></script> <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/> <div id="reportrange" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%"> <i class="fa fa-calendar"></i>&nbsp; <span></span> <i class="fa fa-caret-down"></i> </div> <script type="text/javascript"> window.addEventListener('load',function(){ jQuery(function($) { var start = moment().subtract(29, 'days'); var end = moment(); function cb(start, end) { $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); } $('#reportrange').daterangepicker({ startDate: start, endDate: end, ranges: { 'Today': [moment(), moment()], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Last 7 Days': [moment().subtract(6, 'days'), moment()], 'Last 30 Days': [moment().subtract(29, 'days'), moment()], 'This Month': [moment().startOf('month'), moment().endOf('month')], 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] } }, cb); cb(start, end); }); }); </script> It should work better. ................................................... Sincerely, Olivia Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
platinum602
2 Posts
platinum602 posted this 15 April 2023

thank you.

the added window.addEventListener('load',function(){
jQuery
(function($) {

var start = moment().subtract(29, 'days');
var end = moment();

function cb(start, end) {
    $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
}

did the trick.

i added all the lines above into the HTML element and it worked.

then i tried the same by adding the JS and CSS into the Page Settings Add Head HTML section and the
function only into the HTML element on the page - that also worked.

good day for now,
best
pat

thank you. the added **window.addEventListener('load',function(){ jQuery**(function($) { var start = moment().subtract(29, 'days'); var end = moment(); function cb(start, end) { $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); } did the trick. i added all the lines above into the HTML element and it worked. then i tried the same by adding the JS and CSS into the Page Settings Add Head HTML section and the function only into the HTML element on the page - that also worked. good day for now, best pat
Support Team
Support Team posted this 17 April 2023

Hi,

Nice to hear that everything is fine now, feel free to contact us on any occasion.

...................................................
Sincerely,
Hella
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi, Nice to hear that everything is fine now, feel free to contact us on any occasion. ................................................... Sincerely, Hella Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
You must log in or register to leave comments