Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Could use some javascript help

Featured Replies

I have a form on a site that I am working on that needs to post (php) a day, a month, and a year. On the old site this was done in form of select menus but I would much rather use an html5 date input box or a jquery-ui datepicker.

 

This is what I'm trying to convert: http://jsfiddle.net/#&togetherjs=8raaw5a4xz

 

 

Into: http://jsfiddle.net/#&togetherjs=tGLsw63Fbz

 

 

 

PS. There seems to be a new beta collaboration thingy on jsfiddle. I'm not really sure how it works.

PPS. I probably don't need to support netscape or ie 4 like in the original ;)

  • Author

Great, thank you. So I've come up with this so far:

$(function () {
    
    $('#date').on('change', function() {
         var new_val = jQuery(this).val().split('-'),
             dateYear = parseInt(new_val[0]),
             dateMonth = parseInt(new_val[1]),
             dateDay = parseInt(new_val[2]);
          
        $('<input>', {
            type: 'text',
            name: 'date_day',
            id: 'date_day',
            value: dateDay
        
        }).appendTo('label');
        
        $('<input>', {
            type: 'text',
            name: 'date_month',
            id: 'date_month',
            value: dateMonth
        
        }).appendTo('label');
        
        $('<input>', {
            type: 'text',
            name: 'date_year',
            id: 'date_year',
            value: dateYear
        
        }).appendTo('label');
        
     });
   
});

 

appendTo('label'); is definitely wrong since since I have several labels on the form. I also need to get rid of the original date input before submitting. Plus I am going to run into problems if someone changes the date as there will be several extra input fields. I'm sure this is far from the best way of doing this but it seems to be getting there.

 

http://jsfiddle.net/tu5WU/

Edited by mantis

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.