工作的时候遇到动态添加的问题,尤其是需要拿出指定的域或者id来赋值,是一件比较头疼的问题,最近遇到了诸如此类的问题,有幸分享一些自己的解决经验以及心得。

首先我们先拿input跟select来说

 

<pre>
<code>
 $("select[id^='ywidentifytype']")[0].value = $("#AppliIdentifyType").val();
 $("input[id^='ywinsuredname']")[0].value = $('#AppliName').val();
</code></pre>
<pre><code bbcode=enable> this language will be [b]automatically determined[\b] and inner bbcode is available </code></pre>
<pre><code class="html"> highlight the code with certain language </code></pre>