开发者

Issue with jquery and firefox `Security error" code: "1000`

I've a problem with this instruction in firefox:

$(".photo_data", div).val(url);

In chrome it works well, but in firefox generate this error:

Security error" code: "1000
[Break On This Error] 
a.call(this,o,x.开发者_如何转开发val());if(r==null)r=""...,width:true,height:true,offset:true}, 
jquery.min.js (line 53

the variable url is a url like "http://nerto.it"

How can i do?


Using .val() is for setting the "value" attribute of <input> elements. Divs do not have value attributes, they contain text or html. You would will have success if you try:

$(".photo_data", div).text(url);

If you're trying to insert HTML into the div, you can try:

$(".photo_data", div).html(url);

Read this for more info: http://api.jquery.com/text/


luca can we do something like this $(".photo_data", div).val(url); , for divs we have use text right

if it is a div use .text

$(".photo_data").text(url);

or if it is input use

$(".photo_data").val(url);


Use .html() instead of .val() as you are using divs not inputs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜