jquery html

ITsolutionWizard
ITsolutionWizard used Ask the Experts™
on
Does jquery with HTML5 has like place holder for html control like below?

<div class="form-group">
                            <label class="col-sm-4 control-label">Bond Amount</label>
                            <div class="col-sm-8">
                                 <object id="container" />
                            </div>
                        </div>


function getBondAmountType(bondState,bondName)
{
    if(bondState=="CA")
    {
 	object = "<input type="text" name="test" id="test">"
    }
    else
    {
	object = "<select type="text" name="test" id="test"></select>"
    }
}

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017
Commented:
I repaired some syntactical errors at your jquery code but what exactly do you mean?
function getBondAmountType(bondState,bondName)
{
  var object;
    if(bondState=="CA")
    {
 	 object ='<input type="text" name="test" id="test">';
    }
    else
    {
	 object ='<select type="text" name="test" id="test"></select>';
    }
}

Open in new window

Author

Commented:
if bond state = ca, parse html text box
if bond state != ca, parse html select drop down
both will be in one container.
Distinguished Expert 2017

Commented:
HTML:
<div class="form-group">
     <label class="col-sm-4 control-label">Bond Amount</label>
            <div class="container col-sm-8"></div>
</div>

Open in new window

JQuery script:
  function getBondAmountType(bondState)
{
  var element;
    if(bondState=="CA")
    {
 	 element ='<input type="text" name="test" id="test">';
      $('.container').append(element);
    }
    else
    {      
	 element ='<select type="text" name="test" id="test"></select>';
      $('.container').append(element);
    }
}

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial