Sunday 15 August 2010

jquery - javascript for radio button list -


I have a radio button (6 items below it). And I have a search button, if the user clicks on the search button, the result is all the result. I am bound to the item for the Radiobuttonlist by using the database in .cs file

Position 1: If the user selected Radiobutton1 [item1] as selected. And now if the user again clicks on Radiobutton 1 [item 1] then deselect it.

How to write the onclick function here if I have to check this condition

Either you can provide me a solution in Javascript or JQuery, then no help is great Thank you eagerly for a solution

This is what you should do. Provides enable / disable functionality on each radio-button on the page. You can only change the selector to match that radio.

But let me tell you that enabling / disabling radiobuttons is counter-intuitive, you should actually use the checkbox for it as I can not expect when using your site One should be able to unblock the radiobutan because it is unusual behavior.

  $ ('Input [type = radio]'). Each (function (i, e) {// reserved initial state $ (e). Data ("old", e. Check);}); $ ('Input [type = radio]'). Click (function (e) {var x = $ (this); // If the current state is similar to a saved toggle / then do nothing / (this.checked == x.data ("oldstate")) .checked =! (This.checked); // Save current status x.data ("oldstate", this.checked);});  

No comments:

Post a Comment