jquery - JavaScript Button to href so I can call it from my html -


i built dialog in javascript has 3 buttons this:

            buttons: {             'spara': function() {                  if (!validate()) {                     alert('procent måste vara mellan 0-100');                     return false;                 }                  locstring = "@(url.action("index"))/update/?";                  locstring += '&projectid=' + $('#projectlist').val();                 locstring += '&startdate=' + $('#startdate').val();                 locstring += '&enddate=' + $('#enddate').val();                 locstring += '&pct=' + $('#pct').val();                  var sid = $('#sid').text();                 if (sid != "") {                     locstring += '&id=' + sid;                     //locstring = "/delete/" + sid;                 }                 //window.location = locstring;                  $.ajax({                     type: "get",                     url: locstring,                     datatype: "html",                     success: function(data) {                         //alert(locstring);                         $('#dialog').dialog('close');                         reloadtable();                     }                 });               },             'avbryt': function() {                 $(this).dialog('close');             },             'ta bort': function() {                 var sid = $('#sid').text();                 if (sid != "") {                     locstring = "@(url.action("index"))/delete/" + sid;                     //locstring += '&delete=true&id=' + sid;                      $.ajax({                         type: "get",                         url: locstring,                         datatype: "html",                         success: function(data) {                             $('#dialog').dialog('close');                             reloadtable();                         }                     });                 } 

however, can turn these buttons kind of href can can call them in html code this? <a href="javascript:opendialog()" class="btn btn-primary"> because place them around in dialog pops , style them differently. thanks.

you can use of custom data attribute --

<button data-href="--"  class="btn btn-primary">test</button> 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -