Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

jquery, fill in option value

Inside of jquery - id = 'listMe', how can i get Amount element fill up the <select id='listMe'>?

        <Amount  PrefillValue="No" Min="10000" Max="20000" Year="1"></Amount>
        <Amount  PrefillValue="No" Min="20000" Max="30000" Year="1"></Amount>

function parseSelectXMLBondAmountList(xml, selectid, bondState, bondName) {
    var html = "";
    $('#' + selectid).prop("disabled", false);
    $(xml).find('Bond').each(function (i, e) {
        {
            if (bondState == $(e).find('GeneralInformation').find('State').text() && bondName == $(e).find('GeneralInformation').find('Name').text())
            {
                var selectedBondName = $(e).find('GeneralInformation').find('Name').text();
                var coverageType = $(e).find('Coverage').attr('Type');

                var AmountMax = $(e).find('Amount').attr('Max');
                var AmountMin = $(e).find('Amount').attr('Min');
                html += selectedBondName + " " + coverageType + " " + AmountMax + " " + AmountMin;
                if (coverageType == "list") {
                    $('#bondAmountPlaceHolder').html("<select id='listMe' class='select2'></select>");
                }
                else {
                    $('#bondAmountPlaceHolder').append("<input type='text'  id='bondAmount2' name='bondAmount2' value='" + AmountMax + " />");
                }
            }
        }
    });
    //alert(html);
     
} 

<Surety>
  <SuretyLine>
    <Commercial>
	<Bond>
        <GeneralInformation UI="BondInfo">
          <Name ID="bondName" PrefillValue="Yes">DMV Traffic Violators School Classroom</Name>
          <State ID="bondState" PrefillValue="Yes">CA</State>          
         </GeneralInformation>
        <Coverage Type="List">
          <Amount  PrefillValue="No" Min="10000" Max="10000" Year="1">10000</Amount>
         </Coverage>              
      </Bond>
      <Bond>
        <GeneralInformation UI="BondInfo">
          <Name ID="bondName" PrefillValue="Yes">DMV Traffsdfasdfads</Name>
          <State ID="bondState" PrefillValue="Yes">CA</State>          
         </GeneralInformation>
        <Coverage Type="List">
          <Amount  PrefillValue="No" Min="10000" Max="20000" Year="1"></Amount>
	  <Amount  PrefillValue="No" Min="20000" Max="30000" Year="1"></Amount>
         </Coverage>              
      </Bond>
</Commercial>
  </SuretyLine>
</Surety>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ITsolutionWizard

ASKER

that is different one. I tried yours from another questions. and the <amount> does not loop and I see same amount all the times.
I just do not know how to extract the <amount> in loop.
Any helps?
that is different one. I tried yours from another questions. and the <amount> does not loop and I see same amount all the times.
If it does not work for you then respond in the relevant thread and state that it does not work showing your result.

Please can we resolve one issue at a time -  I believe this question is similar enough to your other question that answering one will answer both. I would prefer to remain in one thread until it is closed.

Lets get the other question solved and if you still have questions we can come back to this thread.
It is ok ... let other to help if you can't
Ok - post back here if you don't get any follow ups.
No follow up