javascript - Jquery Selector to get value of text area -
i want take values of multiple textarea , display them tool tip of highcharts graph.i used input , eq selector values of multiple text areas values not getting returned tooltip..
html code..
<div id="dialog" title="input data"> <form id="pform" > <!--name: <input type="text" name="name" width='50' height='100' maxlength="10" placeholder="fill in data" /><br><br>--> <label for="txt1">data 1:</label> <textarea id="txt1"rows="2" cols="10" name="ar2" maxlength="20" style="resize:none" placeholder="data 1"></textarea><br><br> <label for="txt2">data 2:</label> <textarea id="txt2"rows="2" cols="10" name="ar2" maxlength="20" style="resize:none" placeholder="data 2"></textarea><br><br> <label for="txt3">data 3:</label> <textarea id="txt3"rows="2" cols="10" name="ar2" maxlength="20" style="resize:none" placeholder="data 3"></textarea><br><br> <label for="txt4">data 4:</label> <textarea id="txt4"rows="2" cols="10" name="ar2" maxlength="20" style="resize:none" placeholder="data 4"></textarea><br><br> <label for="txt5">data 5:</label> <textarea id="txt5"rows="2" cols="10" name="ar2" maxlength="20" style="resize:none" placeholder="data 5"></textarea><br><br> <label for="txt6">data 6:</label> <textarea id="txt6"rows="2" cols="10" name="ar2" maxlength="20" style="resize:none" placeholder="data 6"></textarea><br><br> <label for="txt7">data 7:</label> <textarea id="txt7"rows="2" cols="10" name="ar2" maxlength="20" style="resize:none" placeholder="data 7"></textarea><br><br> <label for="txt8">data 8:</label> <textarea id="txt8"rows="2" cols="10" name="ar2" maxlength="20" style="resize:none" placeholder="data 8"></textarea><br><br> <label for="txt9">data 9:</label> <textarea id="txt9"rows="2" cols="10" name="ar2" maxlength="20" style="resize:none" placeholder="data 9"></textarea><br><br> <label for="txt10">data 10:</label> <textarea id="txt10"rows="2" cols="10" name="ar2" maxlength="20" style="resize:none" placeholder="data 10"></textarea><br><br> <label for="txt11">data 11:</label> <textarea id="txt11"rows="2" cols="10" name="ar2" maxlength="20" style="resize:none" placeholder="data 11"></textarea><br><br> <label for="txt12">data 12:</label> <textarea id="txt12"rows="2" cols="10" name="ar2" maxlength="20" style="resize:none" placeholder="data 12"></textarea><br><br> <input type="button" value="ok" onclick="getdata()" /> <input type="button" value="cancel" onclick="getpdata( this.value )" /> </form> </div>
javascript code..
tooltip: { enabled: true, formatter: function() { var seriei = this.series.index; var index = datavalues.indexof(this.y); var index1= datavalues2.indexof(this.y); debugger; var comment = ""; if (seriei == 0) { comment = $("input:eq(" + (index) + ")").val(); } else { comment = $("input:eq(" + (index1) + ")").val(); } return 'the value for, <b>' + this.x + '</b> <b>' + this.y + '</b>' + comment; //return '<b>'+ mytext[this.point.x] +'</b>'; /*var index = datavalues.indexof(this.y); var comment=$("input:eq("+(index)+")").val() return 'the value <b>'+ this.x + '</b> <b>'+ this.y +'</b> -->'+comment;*/ } }
i cannot understand error..the fiddle here http://jsfiddle.net/rbenu/8/ in fiddle text-boxes have been used whereas want use text areas..
please help..
check sample on fiddle http://jsfiddle.net/rbenu/10/
use textarea selector instead of input below
if (seriei == 0) { comment = $("textarea:eq(" + (index) + ")").val(); } else { //comment = "second serie matched!"; comment = $("textarea:eq(" + (index1) + ")").val(); }
Comments
Post a Comment