0

In my website load a js file from commercial service, so I don't have possibility to customize this file, the output of this is a form with various input field, every field have the same class name "wf-input", now I want add to a specific field a jquery date picker but don't have a class for select only a one field.

This is a field I want add a datepicker

<input type="text" name="x4" class="wf-input">

Now my request is how add a class name to only this field?

The only difference between field is (name="x4).

The code for initializing datepicker is this:

$(function() {
    $( ".x4picker" ).datepicker();
  });

How make this work with javascript??

1
  • $("input[name='x4']").addClass("x4picker"); Commented Aug 23, 2015 at 10:55

1 Answer 1

1

The following should do it.

$( "input[name='x4']" ).datepicker();

and if you still want to add class

$( "input[name='x4']" ).addClass('x4picker').datepicker();
Sign up to request clarification or add additional context in comments.

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.