I have the following jquery script, which deals with a query site-visitors enter to search on external sites.
$("#Sbutton"+i).click(function(){
var my_id = $(this).attr('id').substr(8);
//alert(my_id);
SearchUrl = $('#Search'+my_id).val();
SearchQuery = $('#String'+my_id).val();
location = SearchUrl+SearchQuery;
Currently, the query is loaded in the same window as where the query is entered. I’d like to have this in a similar way as ‘target:_blank’. It seems I have to use code something like “.attr(“target”,”_blank”)”, but I can’t seem to figure this out.
an anyone help me with this?
Thanks in advance!
Here’s what you can do (or something like it):
And then your JS:
The basic idea is, you create a handler on the parent form element, which then finds the appropriate data from within it and creates the location string. The event handler then changes the action of the form to the new location string, and submits the form.