Home > front end >  The iframe tag questions
The iframe tag questions

Time:10-24

Page dynamically add iframe label, and given the SEC attributes,
But when I use the $(' iframe). Prop (' SRC ', 'XXX. HTML) will be use iframe show in front of the other pages are all for XXX. HTML

CodePudding user response:

You use $(' iframe) is to obtain all the iframe element on the page, change the properties of course is all iframe element change together,
You should set the unique id for each iframe element, use the id to specify that an iframe element,


Or dynamically create the iframe element, the newly created the iframe element to assign a value to a variable, through this variable change properties,
For example:
Var iframeObj=$(' & lt; Iframe> ');
$(" body "), append (iframeObj);
IframeObj. Prop (' SRC ', 'XXX. HTML);

CodePudding user response:

Can give the iframe a id, and use it every time is $(" id "). Attr (' SRC ', 'XXX. HTML)
  • Related