I am trying to wrap an input statement with a div and then wrap both of those with another div.
I am than trying to add some span code after the input.
All of this works fine separately but not together.
If I run this as written with the wrapAll and Span code commented out, the first div wraps the input statement correctly.
If I uncomment the 2nd line (wrapAll), the first line doesn't wrap the right way. It doesn't wrap the input statement. but the wrapAll statement did wrap both correctly.
I end up with:
instead of:
The span does work correctly but the 1st wrap is still wrong.
Why is that?
Thanks,
Tom
I am than trying to add some span code after the input.
All of this works fine separately but not together.
Code:
<!DOCTYPE html>
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<title></title>
<script src="Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.11.2.js" type="text/javascript"></script>
<script type="text/javascript">
var PopupOn = "";
$(document).ready(function () {
$("input[name*='UserName']").wrap("<div class='input-group usergroup1'/>");
//$("input[name*='UserName'], .usergroup1").wrapAll("<div class='form-group'/>");
//$("input[name*='UserName']").after("<span class='input-group-addon'><i class='glyphicon glyphicon-user'></i></span>");
})
</script>
</head>
<body>
<input class="form-control input-sm" id="UserName" name="UserName" type="text" value="" />
</body>
</html>
If I run this as written with the wrapAll and Span code commented out, the first div wraps the input statement correctly.
If I uncomment the 2nd line (wrapAll), the first line doesn't wrap the right way. It doesn't wrap the input statement. but the wrapAll statement did wrap both correctly.
I end up with:
Code:
...
<div class='form-group'>
<div class='input-group usergroup1'><div>
<input...></input>
</div>
...
instead of:
Code:
...
<div class='form-group'>
<div class='input-group usergroup1'>
<input...></input>
<div>
</div>
...
The span does work correctly but the 1st wrap is still wrong.
Why is that?
Thanks,
Tom