Click here to Skip to main content
15,910,661 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How could i make when click the label go to that page right not when clicking on the label it displays the url in a textbox, but i want i the user clicks the label go to that url in the browser

C#
function successHandler(data) {
    $("#subSiteTitle").keypress(function () {
        var jsonObject = JSON.parse(data.body);
        var dataArr = $.makeArray(jsonObject.d.results);
        var resultArr = $.map(dataArr, function (item) {




            return { label: item.Title, value: "<a href="+item.Url+"></a>", };


        });


        $('#subSiteTitle').autocomplete({
            source: resultArr

        });
Posted
Updated 11-Jan-15 21:36pm
v2
Comments
Kornfeld Eliyahu Peter 12-Jan-15 2:39am    
Create anchor tag and not label...
Kurac1 12-Jan-15 3:00am    
But i want the title to be a label but when clicking a href?
Sinisa Hajnal 12-Jan-15 3:50am    
On autocomplete select, set window.location = your_url. It should do the trick
Kurac1 12-Jan-15 3:56am    
Can u give me an example i dont understand
Kurac1 12-Jan-15 3:18am    
user anchor infront the url only gets displayed its not clickable lika a href tag

1 solution

JavaScript
function successHandler(data) {
    $("#subSiteTitle").keypress(function () {
        var jsonObject = JSON.parse(data.body);
        var dataArr = $.makeArray(jsonObject.d.results);
        var resultArr = $.map(dataArr, function (item) {

            window.location =  item.Url;
        });


        $('#subSiteTitle').autocomplete({
            source: resultArr

        });



if item.url does not contain http:// you will have to add it.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900