0

I have the following file input element in my code:

 echo "<input type='file' name='webpagefileActualFile' id='wpfActualFile' class='dropify' data-default-file='".base_url()."myfolder/valueShouldBeHere' />";

I was trying to change the value of the input type file with

$('#wpfActualFile').val(result.message.webpagefileActualFile);

in my javascript but I get the error Insecure operation.

So the question is: how can I append the value of the result.message.webpagefileActualFile on the end of the data-default-file attribute with jQuery?

user2417624
  • 653
  • 10
  • 32
  • 1
    Well, I can understand that but I am not trying to change the value, but the attribute data-default-file. I can't do even that? – user2417624 Dec 07 '16 at 12:20
  • @Dekel I am not trying to set the value, I find out that I can't do that. I am trying how to set the value of the attribute data-default-file – user2417624 Dec 07 '16 at 12:21
  • 1
    well.. this wasn't the question :) just update your question then... – Dekel Dec 07 '16 at 12:22
  • 1
    I can't mark it as dup (becuase I already marked it based on your prev question), but it's a dup of this: http://stackoverflow.com/questions/13524107/how-to-set-data-attributes-in-html-elements – Dekel Dec 07 '16 at 12:23
  • You cant do because of security reasons...correct!! – rushil Dec 07 '16 at 12:23
  • To set a `data` attribute use `data()` (or `attr()`, depending on use case), not `val()`. See the question I marked as a dupe for more info – Rory McCrossan Dec 07 '16 at 12:28
  • @RoryMcCrossan I am looking at that now,and I am sure that it will help me to solve the issue. Thanks. – user2417624 Dec 07 '16 at 12:35

0 Answers0