jquery binding to jsp nested:text

I have the following JSP:
<nested:text readonly="true" styleClass="normalText" property="date" size="12" />
and the following JQUERY (this is just something I copied, ultimately all I want is a simple datepicker on a simple text field)
   $( document ).ready(function() {
        $.datepicker.setDefaults(
                $.extend($.datepicker.regional[''])
            );
            $('#datepicker_open').click(function(){
                $('#datepicker').datepicker(
                    'dialog',
                    '28.05.2013',
                    function(){
                        alert('Event onSelect');
                    },
                    { showButtonPanel: true }
                );
            });
    });

I tried to do this:
<nested:text readonly="true" styleClass="normalText" property="date" size="12" id="datepicker" />
but JSP processer rejects the "id" attribute.
Thanks,
Mike
LVL 3
mmooreAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gurpsbassiCommented:
Try using the styleId attribute instead e.g.
<nested:text readonly="true" styleClass="normalText" property="date" size="12" styleId="datepicker" />

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mmooreAuthor Commented:
Well, that works but I don't know why. I'm just learning jquery and I thought #datepicker would only bind to the id attribute. Apparently not. Thanks!
0
mmooreAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for mmoore's comment #a40683392

for the following reason:

Solution worked. Would have been nice to have an explanation of why it works, but I guess I can figure that out on my own.
0
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

mmooreAuthor Commented:
It worked!
0
gurpsbassiCommented:
Well, that works but I don't know why. I'm just learning jquery and I thought #datepicker would only bind to the id attribute. Apparently not. Thanks!

It is binding to the Id attribute. If you view the HTML source you will see the text field with the id attribute.

If you look at the API documentation for the text tag in the nested taglib you will see that it extends the <html:text> tag.
The <html:text> tag happens to have a styleId attribute which corresponds to the html id attribute.

I can't seem to find the documentation for the <html:text> tag, this would have shown you the definition of the styleId attribute.
0
mmooreAuthor Commented:
Great! Thanks for making the extra effort. Regards,
Mike
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.