Recently, I came across a jQuery script online that enhances the functionality of my ticketing software by allowing me to add videos to a wiki. However, there is an issue with the code as it doesn't specify a height or width for the video. Is there a way to modify the code to include these dimensions?
if ($('#idEditArticle')) {
var videos = $('a[href$=".m4v"], a[href$=".mp4"]');
$.each(videos, function(i, video) {
$(video).parent().prepend('<video src="'+$(video).attr('href')+'" controls></video><br/>');
});
}
Below is the HTML output:
<p>
<a border="0" class="fb_attachment" href="default.asp?pg=pgDownload&pgType=pgWikiAttachment&ixAttachment=136818&sFileName=Paragon%20Invoice%203.mp4" rel="nofollow" title="">Paragon Invoice 3.mp4</a></p>
Although manually adding height and width attributes to the HTML seems feasible, I encountered difficulties in applying inline CSS styles directly to the elements. Wrapping the content in a div didn't work either, as it deleted the style upon submission.
Is it possible to incorporate height and width specifications into the jQuery code to automatically set these values for the videos?