Spring Handling MVC Form: Clock Radio with JQuery

has anyone using Spring MVC with JQuery!

I'm having a weird issue while handling Spring MVC tags with JQuery.

I have used Spring MVC tags to bind the associated radio objects.

<form:form name="Form1" method="post" action="Form1.do" commandName="Page1Command">

<form:radiobutton path="group" value="TTSE" id="DevGroup_TTSE"  />
<form:radiobutton path="group" value="TTDE" id="DevGroup_TTDE"  />

      

now for some validation task I have used Jquery selector like this:

$("form:radiobutton").click(function() { 
   alert($(this).attr("id"));
 });

      

now it is surprising that I get a warning with the value " Page1Command " which I give for CommandName.

then i tried with id selector for one percussion radio.

$("#DevGroup_TTDE").click(function(){
     alert($(this).attr("id"));
})

      

now i am getting the correct value as "DevGroup_TTDE"

what went wrong with that? we cannot handle Spring MVC tags with JQuery correctly.

By the way, I'm new to both technologies!

any help?

Sincerely.

+2


source to share


1 answer


Tags: Tags are interpreted on the server side and generate regular HTML tags on the client side. Since jQuery only works client-side, it won't be able to find things using form: tags. Try to run the page and view the HTML source and then run the jQuery selector on whatever you see there.



+2


source







All Articles