Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to change the text color using using jquery
    text
    copied!<pre><code>function DoInsert(ind) { var sourceIndex = $("#lstAvailableCode").val(); var targetIndex = $("#lstCodelist").val(); var success = 0; var rightSelectedIndex = $("#lstCodelist").get(0).selectedIndex; var functionName = "/Ajax/SaveCodeforInsert"; if (ind == "plan") { functionName = "/Ajax/SaveCodeforInsertForPlan"; } $.ajax({ type: "POST", traditional: true, url: functionName, async: false, data: "ControlPlanNum=" + $("#ddControlPlan").val() + "&amp;LevelNum=" + $("#ddlLevel").val() + "&amp;ColumnNum=" + $("#ddlColumn").val() + "&amp;SourcbaObjectID=" + sourceIndex + "&amp;TargetbaObjectID=" + targetIndex + "&amp;userID=&lt;%=Model.userID%&gt;", dataType: "json", error: function (data) { alert("Error Adding Code"); FinishAjaxLoading(); }, success: function (data) { if (data == 0) { success = 1; } else { success = data; } FinishAjaxLoading(); var x = $("#lstAvailableCode").val(); $("#lstCodelist").val(x); $("#lstCodelist").val(x).css("background-color", "#ffffff"); } }); </code></pre> <p>Here I am trying to adding one item from lstAvailableCode list box to lstCodelist box. after adding into lstCodelist box I am trying to change the textcolor to yellow or some other color. on my success message i wrote something like this. But I am not able to change the color of the text even I am not able to change the backgroud color of that list box. is that something I am doing wrong here?</p> <p>here is my lstCodelist box code.</p> <pre><code> &lt;select id="lstCodelist" size="17" name="lstCodelist" style="width:100%;height:280px;background-color:#EFEFFB;"&gt;&lt;/select&gt; $.fn.fillSelectDD = function (data) { return this.clearSelectDD().each(function () { if (this.tagName == 'SELECT') { var dropdownList = this; $.each(data, function (index, optionData) { var option = new Option(optionData.Text, optionData.Value); if ($.browser.msie) { dropdownList.add(option); } else { dropdownList.add(option, null); } }); } }); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload