When using the anchor tags download attribute, the user must click on the link for the file to download. How do trigger a file download without the anchor tag? I tried using the JavaScript download() function, but it did not work.
You can click the button via for eg.
Download
In Jquery
<script type="text/javascript">
$(document).ready(function() {
$('a#someid').attr({target: '_blank',
href : 'http://localhost/directory/file.pdf'}).click();
});
</script>
Related
Ok i wanna integrate jquery into codeIgniter view file, and i have trouble put my jquery plugin into right place.
in view file my code is
<script>
$(document).ready(function(){
$("ul.youtube-videogallery").youtubeVideoGallery( {assetFolder:'localhost/yt'} );
});
</script>
I made folder called yt in my root file htacces/rip/yt - and put plug in into it. How to write {assetFolder:'localhost/yt'} in correct way. My plugin isnt working. So help me to taret assets folder???
Assuming your CI-directory is localhost (that is, not a subfolder of localhost):
{assetFolder:'<?php echo base_url(); ?>yt'}
I am using RazorPdf to generate a .pdf document from one of my controller actions. All works well, except that in my generated .pdf, I have an embedded anchor that opens yet another .pdf, that resides on the web site.
Currently, if the user clicks the anchor, the referenced .pdf opens in the same browser window. I don't want this behavior. I want anchor to open in a new browser tab (e.g. target="_blank"), but can't see any way to accomplish this. Here's my anchor in my view:
<!-- Note: target="_blank" does not work //-->
<anchor target="_blank" font="underline" name="top" reference="http://www.example.com/Downloads/Attachment.pdf">Click Here</anchor>
You could add some jquery function and call it on the click of the anchor tag
jquery function something like
$("#OpenAttachment").click(function (e) {
var actionUrl = '/Downloads/Attachment.pdf';
window.open(actionUrl, '', 'width=1000,height=800');
});
This will open a new browser window. Hope this helps :)
I have a jsp named home.jsp. On click of "activate now" button in this jsp, a lightbox is being displayed.
This lightbox has 2 buttons "activate" and "remove".
When I click on "activate" button, a service is being activated. On successful activation, page is reloaded and home.jsp is displayed.
Now i want to display an alert when this happens. Can anyone please help me with this?
Your home.jsp page should queue a JavaScript snippet that runs immediately after the page gets loaded (and once it's activated). I recommend using jQuery which will make this a lot easier. Here is a dirty example:
<html>
<head>
...
<script type="text/javascript">
jQuery().ready(window,function(){
alert("your account is activated");
});
</script>
...
</head>
<body>
...
i am using script tag in my MVC view and my src for Script tag is "http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js".
the issue iam facing is html buttons are not working/postingback.
If i remove script tag,everything works fine.
whts the actuals problem with my code.?
there could be number of issues, the script tag you are refereing to includes the jquery library from the CDN. One possibility could be that there is some javascript code in the view that is disabling your buttons you can verify by doing the following
1) keep the script tag (jQuery) included in the view
2) in the script section of your view (if you have else create one like)
<script>
$(function(){
$(":button").removeAttr("disabled");
});
</script>
3) so your final code will look like
<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js"></script>
<script>
$(function(){
$(":button").removeAttr("disabled");
});
</script>
check now if it works... if it works then it means that you have some code that is disabling the buttons and upon removal of jquery library js error would have occured that why it seems to work...
I am not able to get my jwysiwyg and Jhtmlarea text editors to work within an AJAX loaded Jquery UI Tab
Both text editors work when loaded normally.
This loads the tabs on the "View Page"
<script type="text/javascript">
$(function() {
$("#tabs").tabs();
});
</script>
This loads the page via AJAX on the "View Page"
<li>Edit</li>
This loads the Html Area on the "Edit Page"
<script type="text/javascript" charset="utf-8">
$(function(){
$("textarea").htmlarea();
});
</script>
All help would be greatly appreciated.
Tim
because you're injecting the things you're trying to htmlarea-ize into the DOM after the page loads, you have to put your $("textarea").htmlarea() inside the callback function of the ajax call.