Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

check value in Javascript

Posted on 2014-10-30
2
Medium Priority
?
222 Views
Last Modified: 2014-11-01
Is this the rigth way of create a function in js? I want to add a condition. If value_1 = 'YES" then check box, if not leave it blank.
function GetNameValue1(value_1) {
  if ((value_1[2].value == "YES")) {
    ASPxCheckBox_l_default.SetChecked(true);
  }
  else {
    ASPxCheckBox_l_default.SetChecked(false);
  }
}

Open in new window

0
Comment
Question by:VBdotnet2005
1 Comment
 
LVL 60

Accepted Solution

by:
Julian Hansen earned 2000 total points
ID: 40413783
The function is correct - whether or not it does what you want it to or not depends on where it lives.

Are you asking if the function will do what you want or are you asking if in terms of javascript syntax it is written correctly?

The javascript is correct - subject to the following requirements

The parameter value_1 is an array of objects
The array has an element with a key of 2
The object at value_1[2] has a member called 'value'
ASPxCheckBox_l_default is defined and has a method called SetChecked

If the above requirements are met then the function is correct.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question