jquery - Append does not work when I try to code in Javascript OOP style -
i learning concepts of programming in javascript oop style , need little help:
first, simple html form:
<form> <select id="jobrole"></select> </form>
next, write "question" class:
var question = function() { this.masterq = function (id1) { this.id1 = jquery(id1); this.id1.append('<option value="">test</option>'); }; }
now instantiate question class, making new object
var q = new question();
and call masterq method:
q.masterq('#jobrole');
but, have no idea why test isn't appended onto select.
any ideas?
thank you!
i try , code works -> http://jsfiddle.net/hxhh2/1/
are sure included jquery in page
<script src="pathtojquery.js"></script>
or maybe execute code before dropdown on page. wrap logic into
$(document).ready(function() { // code here });
Comments
Post a Comment