Click here to Skip to main content
15,886,919 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionChanging the last text of a loop Pin
Member 1184968824-Jul-15 4:53
Member 1184968824-Jul-15 4:53 
AnswerRe: Changing the last text of a loop Pin
Richard MacCutchan24-Jul-15 5:40
mveRichard MacCutchan24-Jul-15 5:40 
AnswerRe: Changing the last text of a loop Pin
ZurdoDev24-Jul-15 5:58
professionalZurdoDev24-Jul-15 5:58 
AnswerRe: Changing the last text of a loop Pin
Anil Vaghasiya24-Jul-15 19:52
professionalAnil Vaghasiya24-Jul-15 19:52 
QuestionHow do I make the Comment box conditional mandatory box? (SOLVED) Pin
samflex23-Jul-15 8:20
samflex23-Jul-15 8:20 
AnswerRe: How do I make the Comment box conditional mandatory box? Pin
Richard Deeming23-Jul-15 9:04
mveRichard Deeming23-Jul-15 9:04 
GeneralRe: How do I make the Comment box conditional mandatory box? Pin
samflex23-Jul-15 9:14
samflex23-Jul-15 9:14 
GeneralRe: How do I make the Comment box conditional mandatory box? Pin
Richard Deeming23-Jul-15 9:34
mveRichard Deeming23-Jul-15 9:34 
Yes. You just need to set up a comment box for each question, with its own rule. The dependency expression would use the name of the radio buttons for the question - for example:
JavaScript
promptness-comments: {
    required: "input:radio:checked[name='promptness'][value='2'], input:radio:checked[name='promptness'][value='1']"
}

You'd then just need a script to monitor the click event of each radio-button, and show or hide the relevant comment box. How you find the relevant comment box for the clicked radio button is up to you - I'd be inclined to use a predictable ID:
HTML
<textarea id="promptness-comments" name="promptness-comments" rows="2" cols="50"></textarea>
...
<script>
$(document).ready(function () {
    ...
    $("#form1").on("click", "input:radio", function(){
        var group = this.name;
        var commentsId = "#" + group + "-comments";
        $(commentdId).toggle(this.value === "1" || this.value === "2");
    });
});
</script>




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: How do I make the Comment box conditional mandatory box? Pin
samflex23-Jul-15 10:15
samflex23-Jul-15 10:15 
Questionhow to add image in columns in datatables using jquery and json Pin
Member 1185791223-Jul-15 3:56
Member 1185791223-Jul-15 3:56 
QuestionRe: how to add image in columns in datatables using jquery and json Pin
ZurdoDev24-Jul-15 5:59
professionalZurdoDev24-Jul-15 5:59 
QuestionSeeking Former Ford Employees Pin
Member 1185572122-Jul-15 7:09
Member 1185572122-Jul-15 7:09 
QuestionIf ... Else If ... Else statements Pin
Member 1184785021-Jul-15 18:41
Member 1184785021-Jul-15 18:41 
AnswerRe: If ... Else If ... Else statements Pin
Brisingr Aerowing21-Jul-15 19:24
professionalBrisingr Aerowing21-Jul-15 19:24 
AnswerRe: If ... Else If ... Else statements Pin
Richard MacCutchan21-Jul-15 20:32
mveRichard MacCutchan21-Jul-15 20:32 
QuestionSimple Ajax program will not work Pin
Truck5321-Jul-15 15:36
Truck5321-Jul-15 15:36 
AnswerRe: Simple Ajax program will not work Pin
Peter Leow21-Jul-15 16:21
professionalPeter Leow21-Jul-15 16:21 
GeneralRe: Simple Ajax program will not work Pin
Truck5322-Jul-15 0:13
Truck5322-Jul-15 0:13 
GeneralRe: Simple Ajax program will not work Pin
F-ES Sitecore22-Jul-15 0:44
professionalF-ES Sitecore22-Jul-15 0:44 
QuestionTo convert audio file into byte array in javascript Pin
Rohan Jadhav20-Jul-15 6:02
Rohan Jadhav20-Jul-15 6:02 
QuestionHow to shorten/combine "if()" statements? Pin
Member 1184968820-Jul-15 4:58
Member 1184968820-Jul-15 4:58 
AnswerRe: How to shorten/combine "if()" statements? Pin
Member 1185045020-Jul-15 13:18
Member 1185045020-Jul-15 13:18 
AnswerRe: How to shorten/combine "if()" statements? Pin
Godhaniketan20-Jul-15 19:24
professionalGodhaniketan20-Jul-15 19:24 
GeneralRe: How to shorten/combine "if()" statements? Pin
Richard MacCutchan20-Jul-15 20:50
mveRichard MacCutchan20-Jul-15 20:50 
GeneralRe: How to shorten/combine "if()" statements? Pin
Richard MacCutchan20-Jul-15 21:37
mveRichard MacCutchan20-Jul-15 21:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.