Solved

check value in Javascript

Posted on 2014-10-30
2
201 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 57

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…

739 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