javascript - Divide the anchor string value? -


i have anchor inject in html in jqgrid formatter below:

var number = rowobject.number; var platenumber = rowobject.platenmber; var markup = "<a href=%href%;>%text%</a>" var replacements = {     "%text%": platenumber ,     "%href%": "javascript:search.openviewbyplatenumber(" + number + "," + platenumber + ")" };  markup = markup.replace(/%\w+%/g, function(all) {     return replacements[all]; }); 

here openviewbyplatenumber function:

var openviewbyplatenumber = function(number, platenumber) {     // }; 

in ui there number in grid. when click on number openviewbyplatenumber function called. working fine me. problem plate number string type. number can 1, 2, 3/4, 340/2 etc.

it's working fine when number simple 1, 5 or 9 if number 340/2, method receives value of 170.5. divides number. how can pass string?

to pass values function string wrap them in quotes:

"%href%": 'javascript:search.openviewbyplatenumber("' + number + '","' + platenumber + '")' 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -