[英]EJB entity manager remove() result in Cannot delete or update a parent row
I use jquery .find('input')[0]
which gives me a element like this 我使用jquery .find('input')[0]
这给了我这样的元素
<input name='world' value='hello'>
I want to change the value of this textfield. 我想更改此文本字段的值。 I then find('input')[0].val('')
, but it gave me a type error. 然后我find('input')[0].val('')
,但是它给了我一个类型错误。 Any insight please ? 有什么见识吗?
Use :first
to get the first input. 使用:first
获取第一个输入。
find('input:first').val('your value here')
or 要么
find('input:eq(0)').val('your value here');
When you do find('input')[0]
, you're actually getting the DOM element and since it's no longer wrapped in a jquery object the .val
property will not work. 当您执行find('input')[0]
,实际上是在获取DOM元素,并且由于它不再包装在jquery对象中,因此.val
属性将不起作用。
If you really want to use your previous code then you could use the native DOM property value
如果您确实要使用以前的代码,则可以使用本机DOM属性value
find('input')[0].value
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.