Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-23-2013, 07:05 PM   PM User | #1
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
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 05:38 AM..
nani_nisha06 is offline   Reply With Quote
Old 01-24-2013, 03:08 AM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
Code:
$("#firstelement,#secondelement,#thirdelement").datetimepicker()
or you can give them all the same class and do

Code:
$(".myclass").datetimepicker()
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Users who have thanked DanInMa for this post:
nani_nisha06 (01-24-2013)
Old 01-24-2013, 05:10 AM   PM User | #3
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
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 
});
nani_nisha06 is offline   Reply With Quote
Old 01-24-2013, 05:15 AM   PM User | #4
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
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
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 01-24-2013, 05:27 AM   PM User | #5
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
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
nani_nisha06 is offline   Reply With Quote
Old 01-24-2013, 05:37 AM   PM User | #6
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
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
nani_nisha06 is offline   Reply With Quote
Old 01-24-2013, 02:52 PM   PM User | #7
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
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/
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:52 PM.


Advertisement
Log in to turn off these ads.