0

I have timepicker in page for one textbox, i want to use it for more textboxes in this page?!


<head>
<script type="text/javascript">
    $(document).ready(function () {
        $('#example8', '#TextBox1').timepicker({
            ampm: true                
        });
    });
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
    <input type="text" name="example8" id="example8" value="" />
</div>    
</form>
</body>
0

4 Answers 4

3

You can do something like this

        <script type="text/javascript">
            $(document).ready(function () {
                $('.needstimepicker').timepicker({
                    ampm: true                
                });
            });
        </script>



        <div>
            <input type="text" class="needstimepicker" name="example8" id="example8" value="" />
            <input type="text" class="needstimepicker" name="example8" id="example9" value="" />
            <input type="text" class="needstimepicker" name="example8" id="example10" value="" />
        </div> 
Sign up to request clarification or add additional context in comments.

1 Comment

how can i use it in page that use maste page?
2

You need to use the , selector in a single string:

$("#this, #that").whatever()

Comments

2
try something like this

<head>
<script type="text/javascript">
    $(document).ready(function () {
        $('.timepicker', '#form1').timepicker({
            ampm: true                
        });
    });
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
  <input type="text" class="timepicker" name="picker1" id="picker1" value="" />
  <input type="text" class="timepicker" name="picker2" id="picker2" value="" />
  <input type="text" class="timepicker" name="picker3" id="picker3" value="" />
</div>    
</form>
</body>

Comments

1

Try this:

<script type="text/javascript">
            $(document).ready(function () {
                 $('.needstimepicker').each(function(){
                 $(this).timepicker({
                    ampm: true                
                });
               });

            });
        </script>



        <div>
            <input type="text" class="needstimepicker" name="example8" id="example8" value="" />
            <input type="text" class="needstimepicker" name="example8" id="example9" value="" />
            <input type="text" class="needstimepicker" name="example8" id="example10" value="" />
        </div> 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.