Solved

check value in Javascript

Posted on 2014-10-30
2
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 56

Accepted Solution

by:
Julian Hansen earned 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
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…

749 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