On dropdown change event i am making a column mandatory. if you see the below pic for the first time when TypeofRequest="508web" what format should be return as becomes mandatory. The below code works fine for the first time when i change the dropdown. Once i change the value and come back it is adding 2 stars to the nobr text (refer screen shot below).
how can we over come this
Function for the same
function MandateColumn(ColNames, mandatory)
{for(var i=0;i<ColNames.length;i++)
{
if(mandatory=="True"){ var controlvalidate= $("[id^='"+ColNames[i]+"']").prev('td').text();
var spanTag ="<span class=\"ms-formvalidation\"> *</span>";
var newHtml1 = controlvalidate;
newHtml =newHtml1 + spanTag;
$("nobr").filter(function()
{return $(this).text() === controlvalidate;}).html(newHtml);}else{ }}}
Calling the above function (
var BPHCMandateCols= ['FormatShouldReturnas'];
MandateColumn(BPHCMandateCols,"True")
var spanTag ="<span class=\"ms-formvalidation\"> *</span>";
?