Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    179
    Thanks
    39
    Thanked 2 Times in 2 Posts

    datetime picker issue

    Hi All,

    I am using below linked jquery plugin in one of my project and now I have small issue.

    In a form when i want to use these plugin it need multiple function for each entry so can I do something like a fixed used for multiple datetime picker feilds with out duplicating it.

    Code:
    http://trentrichardson.com/examples/timepicker/
    function is :
    PHP Code:
    $('#slider_example_2').datetimepicker({
        
    showSecondtrue,
        
    timeFormat'HH:mm:ss',
        
    stepHour2,
        
    stepMinute10,
        
    stepSecond10
    }); 
    Last edited by nani_nisha06; 01-24-2013 at 06:38 AM.

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    Code:
    $("#firstelement,#secondelement,#thirdelement").datetimepicker()
    or you can give them all the same class and do

    Code:
    $(".myclass").datetimepicker()

  • Users who have thanked DanInMa for this post:

    nani_nisha06 (01-24-2013)

  • #3
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    179
    Thanks
    39
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by DanInMa View Post
    or you can give them all the same class and do

    Code:
    $(".myclass").datetimepicker()
    Danin,

    I bit interested to understand this.

    On the above example if I change code as below will that be okay?

    Code:
    $(".slider_example_2").datetimepicker({ 
        showSecond: true, 
        timeFormat: 'HH:mm:ss', 
        stepHour: 2, 
        stepMinute: 10, 
        stepSecond: 10 
    });

  • #4
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    then it will apply to all inputs with a class of "slider_example_2", ( not an id)

    i think you need to explain what you want in more detail

  • #5
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    179
    Thanks
    39
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by DanInMa View Post
    then it will apply to all inputs with a class of "slider_example_2", ( not an id)

    i think you need to explain what you want in more detail
    Danin,

    I am using these plugin for timedate picker.

    I have a form which need multiple datetime fields...but when I have used above function for only fist field is was able to get the datetime. my requirement is when ever I use the "slider_example_2" in the form as Id that field should enable datetime picker.


    I am noob to javascript so I am not able to work on these small fuction that has choke all my functionality.


    Appreciate your help.

    Thanks,
    Nani

  • #6
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    179
    Thanks
    39
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by DanInMa View Post
    then it will apply to all inputs with a class of "slider_example_2", ( not an id)

    i think you need to explain what you want in more detail
    DanINMa,

    declaring as class has solved my problem.

    Thanks for your support.

    Regards,
    Nani

  • #7
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    Excellent! You should take a look at this page sometime, I dont have them all memorized so I use this page often
    http://api.jquery.com/category/selectors/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •