Open new tab on button click using JQUERY


Rajan

My scene is like this:

I have edit user module. Each user is assigned a base INI file . When we edit a user, we have a drop down menu from which to select his base INI file.

After selection, we can save the user. And the ID of the selected file is also saved.

everything is normal.

However, when we edit a user, I have the option to let the user create custom_ini_file. So when he clicks the edit button, the code copies the content from a file and creates a new file, then lets the user make custom changes in it, and the file will be saved.

Now I want to open this edit custom_ini_filein a new tab or window and keep the user edit page open. Once he has finished editing the file, only then can he go back to editing the user and save the user.

So basically, he should be able to edit users and files.

Now in the edit user, I have a dropdown like this along with the "edit" button:

<tr>
    <td>Base INI File</td>
    <?php 

        if(isset($_GET['id'])) { 
            $id=$_GET['id']; 
            btn_edit($id); 
        } 
    ?>  
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> 


    <td> 
        <select required name="base_ini_id" id="base_ini_id" class="form-control"> 
            <option value="">Select</option> 
            <?php foreach($base as $value) { ?> 
                <option id="emp" class="specialLink" value="<?php echo $value->id;?>"><?php echo $value->base_ini_filename;?></option> 
            <?php } ?> 
        </select> 
    </td> 
    <td> 
        <?php echo btn_edit('customer/upload_ini/edit_ini_custom/'); ?> 
    </td> 
    <script type="text/javascript"> 
        $(document).ready(function() { 
            $('#base_ini_id').change(function() { 
                var id = $("#base_ini_id").val();
                var url = "/project/customer/upload_ini/edit_ini_custom/";

                $("#edit_link").attr("href",url+ id); 

            }); 
        }); 
    </script>
</tr>

edit button

function btn_edit ($uri)
{
    return anchor($uri, '<i class="glyphicon glyphicon-edit"></i>','id="edit_link"');
}
Santosh Ram Kunjir

in the assistant

 anchor($uri, '<i class="glyphicon gl yphicon-edit"></i>','id="edit_link"'); 

replace it with follow and it will work

 anchor($uri, '<i class="glyphicon glyphicon-edit"></i>',array('id'=>"edit_link", 'target'=> '_blank');

in jQuery

$("#edit_link").attr("target","_blank");

Related


Open new tab on button click using JQUERY

Rajan My scheme is this: I have edit user module. Each user is assigned a base INI file . When we edit a user, we have a drop down menu from which to select his base INI file. After selection, we can save the user. And the ID of the selected file is also saved

Open new tab on button click using JQUERY

Rajan My scheme is this: I have edit user module. Each user is assigned a base INI file . When we edit a user, we have a drop down menu from which to select his base INI file. After selection, we can save the user. And the ID of the selected file is also saved

Click the button to open a new tab

Nathan Wilson I want to create a link with a button that opens in a new tab. The code I'm currently using is currently opening a blank tab and I'm not sure why. <div class="text text-left"> <h2>WORK</h2> <h1>Title</h1> <p>Lorem ipsum dolor sit am

Click the button to open a new tab

Nathan Wilson I want to create a link with a button that opens in a new tab. The code I'm currently using is currently opening a blank tab and I'm not sure why. <div class="text text-left"> <h2>WORK</h2> <h1>Title</h1> <p>Lorem ipsum dolor sit am

Open a new tab after button click in AngularJS

Neptune: <button type="button" class="btn btn-primary" ng-click="openTab()">new tab</button> openTab = function () { $http.post('www.google.com'); } What I want is to post a requirement and then open the response html in a new tab when the "openTab" button

Protractor button click and open page in new tab

Sumitomo I am new to protractor. I'm trying to automate a scenario where I click a button and it opens a page in a new tab and then we need to populate the form in the new page and submit it. Problem : When I click the button to open a new page. My tests don't

Click Primefaces in a new tab on the button to open the page

username i have this <h:outputLink value="http://.....index.html" target="_blank">open</h:outputLink> But it shows up as a link. How to create a similar button? I need the "Open" button. When I press this button I need to open the link in a new tab in the bro

Protractor button click and open page in new tab

Sumitomo I am new to protractor. I'm trying to automate a scenario where I click a button and it opens a page in a new tab and then we need to populate the form in the new page and submit it. Problem : When I click the button to open a new page. My tests don't

Open a new tab after button click in AngularJS

Neptune: <button type="button" class="btn btn-primary" ng-click="openTab()">new tab</button> openTab = function () { $http.post('www.google.com'); } What I want is to post a requirement and then open the response html in a new tab when the "openTab" button

Protractor button click and open page in new tab

Sumitomo I am new to protractor. I'm trying to automate a scenario where I click a button and it opens a page in a new tab and then we need to populate the form in the new page and submit it. Problem : When I click the button to open a new page. My tests don't

Click Primefaces in a new tab on the button to open the page

username i have this <h:outputLink value="http://.....index.html" target="_blank">open</h:outputLink> But it shows up as a link. How to create a similar button? I need the "Open" button. When I press this button I need to open the link in a new tab in the bro

Click Primefaces in a new tab on the button to open the page

username i have this <h:outputLink value="http://.....index.html" target="_blank">open</h:outputLink> But it shows up as a link. How to create a similar button? I need the "Open" button. When I press this button I need to open the link in a new tab in the bro

Click Primefaces in a new tab on the button to open the page

username i have this <h:outputLink value="http://.....index.html" target="_blank">open</h:outputLink> But it shows up as a link. How to create a similar button? I need the "Open" button. When I press this button I need to open the link in a new tab in the bro

Protractor button click and open page in new tab

Sumitomo I am new to protractor. I'm trying to automate a scenario where I click a button and it opens a page in a new tab and then we need to populate the form in the new page and submit it. Problem : When I click the button to open a new page. My tests don't

Open a new tab after button click in AngularJS

Neptune: <button type="button" class="btn btn-primary" ng-click="openTab()">new tab</button> openTab = function () { $http.post('www.google.com'); } What I want is to post a requirement and then open the response html in a new tab when the "openTab" button

Protractor button click and open page in new tab

Sumitomo I am new to protractor. I'm trying to automate a scenario where I click a button and it opens a page in a new tab and then we need to populate the form in the new page and submit it. Problem : When I click the button to open a new page. My tests don't

Click Primefaces in a new tab on the button to open the page

username i have this <h:outputLink value="http://.....index.html" target="_blank">open</h:outputLink> But it shows up as a link. How to create a similar button? I need the "Open" button. When I press this button I need to open the link in a new tab in the bro

Click Primefaces in a new tab on the button to open the page

username i have this <h:outputLink value="http://.....index.html" target="_blank">open</h:outputLink> But it shows up as a link. How to create a similar button? I need the "Open" button. When I press this button I need to open the link in a new tab in the bro

Close open tab using jquery on close button

User 6551260 Here is my code it works fine on localhost but not in live environment not why <script language="javascript" type="text/javascript"> function closeWindow() { window.open('','_parent',''); window.close(); } </script> <a href="javascript:closeW

Alert on button click and move user to open new tab

Dashan I created a button with a link that opens in a new tab. I also used JavaScript for reminders. Currently this code works fine. But after clicking OK in the Alert, the user stays on the same page. But I want to move the user to the newly opened tab. is it

button click: open a new browser tab and call a function

fiber I have a button which calls a function: Perform an AJAX PHP request to the database Display the retrieved data in a div container scroll to div container with bookmark (#) I want a button to do the same task, but with one action, which is to open a new t

Alert on button click and move user to open new tab

Dashan I created a button with a link that opens in a new tab. I also used JavaScript for reminders. Currently this code works fine. But after clicking OK in the Alert, the user stays on the same page. But I want to move the user to the newly opened tab. is it

Alert on button click and move user to open new tab

Dashan I created a button with a link that opens in a new tab. I also used JavaScript for reminders. Currently this code works fine. But after clicking OK in the Alert, the user stays on the same page. But I want to move the user to the newly opened tab. Is it

When button click code needs to open output on new tab

Ammonium chloride I am using apex 18.1 with database 11g in windows and my page has dynamic actions with the following Executre java script; apex.navigation.redirect('localhost:1234/reports/rwservlet? server=servername.&report=myrep.rdf&userid=user/pwd@link&de

On button click Open file from server in new tab

Confirm 31 I have a button in a modal that should open a sample struct file to submit, which is in my server. I have tried using: <button type="button" class="btn btn-info" style="float: left" onclick="window.open('/some/path/to/file/file.pdf')">A FILE</button

Alert on button click and move user to open new tab

Dashan I created a button with a link that opens in a new tab. I also used JavaScript for reminders. Currently this code works fine. But after clicking OK in the Alert, the user stays on the same page. But I want to move the user to the newly opened tab. is it

Alert on button click and move user to open new tab

Dashan I created a button with a link that opens in a new tab. I also used JavaScript for reminders. Currently this code works fine. But after clicking OK in the Alert, the user stays on the same page. But I want to move the user to the newly opened tab. is it