If they are variables in the window
scope, then you can access window['option'+i]
. However, you really should just use an array:
var option = [
"some text",
"option 2",
"option 3"
];
for( var i=0; i<3; i++) alert(option[i]);
More Related Contents:
- javascript change element from another page
- javascript show intro animation, then website
- How to pass arguments to addEventListener listener function?
- How to send an email from JavaScript
- Choosing and activating the right controls on an AJAX-driven site
- How to pass parameters using ui-sref in ui-router to controller
- VueJS: why is “this” undefined?
- Prevent zoom cross-browser
- Intercepting call to the back button in my AJAX application
- Setting innerHTML vs. setting value with Javascript
- How can I generate an apk that can run without server with react-native?
- Onclick event not firing on jsfiddle.net [closed]
- Attach a body onload event with JS
- Upload base64 image with Ajax
- Catch all unhandled javascript promise rejections
- Creating Rooms in Socket.io
- How do I clean up and unload a WebGL canvas context from GPU after use?
- Can I use additional parameters in recursion problems?
- How to use querySelectorAll only for elements that have a specific attribute set?
- How to remove part of a string before a “:” in javascript?
- How to close an iframe within iframe itself
- Javascript Error: IPython is not defined in JupyterLab
- Capturing window.onbeforeunload
- JavaScript Multidimensional Arrays [duplicate]
- Refresh iFrame (Cache Issue)
- Programmatically creating an SVG image element with javascript
- Synchronous XMLHttpRequest on the main thread is deprecated
- jQuery: noConflict
- Is there any size limitation for ajax post?
- Internet Explorer full screen mode?