0

Is it possible to add the css class named color to the textbox define inside the javascript below?

<script type="text/javascript">

newTextBoxDiv.after().html('<label>Colors and price: #'+ counter + ' : </label>' + '<input name="colors[]" value=""  >');

</script>

thanks

4

4 回答 4

0

这应该这样做

newTextBoxDiv.after().html('<label>Colors and price: #'+ counter + ' : </label>' + '<input name="colors[]" value="" class="color" >');
于 2012-07-10T11:13:34.187 回答
0

你的意思是,输入?

简单地

'<input name="colors[]" value="" class="color">'
于 2012-07-10T11:13:42.883 回答
0

是的

newTextBoxDiv.siblings("input:text[name='colors[]']").addClass('color');
于 2012-07-10T11:13:52.733 回答
0

如果你的意思是newTextBoxDivthen 使用:

newTextBoxDiv.addClass('color');

如果是输入,则:

'<input name="colors[]" value="" class="color">'
于 2012-07-10T11:15:00.580 回答