asp.net mvc - Trying to concatenate Html Textbox -


i'm trying create 1 textbox combines 2 textbox fields (rack , row) one.
code:

@html.textboxfor(m => m.server.rack, new { @class= "form-control" })  @html.textboxfor(m => m.server.row, new { @class = "form-control" }) 

i'm trying combine server.rack , server.row same textbox. possible in code?

your form:

<form> <input type="text" id="input1" onblur="concat()"/> <input type="text" id="input2" onblur="concat()"/> </form> <p id="concat"></p> 

and javascript:

function concat(){   var x = document.getelementbyid('input1').innerhtml;   var y = document.getelementbyid('input2').innerhtml;   document.getelementbyid('concat').innerhtml = x.concat(y); } 

what do: when text boxes loose focus, javascript read information in each textbox. print results of both textboxes (even if 1 blank) <p id="concat"></p>.

warning: code written without checking errors or testing. review code before using.

additional info: client side, not server side.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -