how to empty search box on click event in wenzhixin bootstrap table without refresh page?
up vote
0
down vote
favorite
I want to empty search box. when I click anywhere on a page then without refresh page I want to get an only empty search box in a wenzhixin bootstrap table
<table id="view_table" data-toggle="table"
data-search="true"
data-page-list="[5, 10, 20]"
data-page-size="5"
data-pagination="true"
data-show-pagination-switch="true" >
<thead>
<tr class="table-heading">
<th data-field="image"><h4>Image</h4></th>
<th data-field="name"><h4>Name</h4></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<button id="empty_search" class="btn btn-primary">Save</button>
<script>
$('#empty_search').on('click', function(){
$.(this.["data-search"]).empty();
});
</script>
javascript jquery css bootstrap-table
|
show 5 more comments
up vote
0
down vote
favorite
I want to empty search box. when I click anywhere on a page then without refresh page I want to get an only empty search box in a wenzhixin bootstrap table
<table id="view_table" data-toggle="table"
data-search="true"
data-page-list="[5, 10, 20]"
data-page-size="5"
data-pagination="true"
data-show-pagination-switch="true" >
<thead>
<tr class="table-heading">
<th data-field="image"><h4>Image</h4></th>
<th data-field="name"><h4>Name</h4></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<button id="empty_search" class="btn btn-primary">Save</button>
<script>
$('#empty_search').on('click', function(){
$.(this.["data-search"]).empty();
});
</script>
javascript jquery css bootstrap-table
this.["data-search"]
makes no sense to begin with. Apart from thatthis
probably isn’t what you expect it to be in that context, the syntax is bogus as well - it is eitherfoo.bar
orfoo[bar]
- but not dot and square brackets.
– misorude
2 days ago
try to use$( this ).data( "search", '' )
instead of$.(this.["data-search"]).empty()
– Stranger
2 days ago
@Stranger, yes I tried but not work.
– vicky793
2 days ago
@misorude, $('#empty_search').on('click', function(){ $("#view_table[data-search]").empty() }); is right?
– vicky793
2 days ago
That would select thetable
element in your example (because it has that id, and has an attribute nameddata-search
) - but I doubt you actually want to “empty” the whole table(?). You are talking about a search field, but there is no such thing in the code you have shown above. If that field gets created dynamically by another script, then use your browser dev tools to inspect it and find out what id (or other characteristics suitable for selection, if necessary) it has. And to empty an input field, the right method would be setting the value to an empty string.
– misorude
2 days ago
|
show 5 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to empty search box. when I click anywhere on a page then without refresh page I want to get an only empty search box in a wenzhixin bootstrap table
<table id="view_table" data-toggle="table"
data-search="true"
data-page-list="[5, 10, 20]"
data-page-size="5"
data-pagination="true"
data-show-pagination-switch="true" >
<thead>
<tr class="table-heading">
<th data-field="image"><h4>Image</h4></th>
<th data-field="name"><h4>Name</h4></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<button id="empty_search" class="btn btn-primary">Save</button>
<script>
$('#empty_search').on('click', function(){
$.(this.["data-search"]).empty();
});
</script>
javascript jquery css bootstrap-table
I want to empty search box. when I click anywhere on a page then without refresh page I want to get an only empty search box in a wenzhixin bootstrap table
<table id="view_table" data-toggle="table"
data-search="true"
data-page-list="[5, 10, 20]"
data-page-size="5"
data-pagination="true"
data-show-pagination-switch="true" >
<thead>
<tr class="table-heading">
<th data-field="image"><h4>Image</h4></th>
<th data-field="name"><h4>Name</h4></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<button id="empty_search" class="btn btn-primary">Save</button>
<script>
$('#empty_search').on('click', function(){
$.(this.["data-search"]).empty();
});
</script>
javascript jquery css bootstrap-table
javascript jquery css bootstrap-table
edited 2 days ago
asked 2 days ago
vicky793
347
347
this.["data-search"]
makes no sense to begin with. Apart from thatthis
probably isn’t what you expect it to be in that context, the syntax is bogus as well - it is eitherfoo.bar
orfoo[bar]
- but not dot and square brackets.
– misorude
2 days ago
try to use$( this ).data( "search", '' )
instead of$.(this.["data-search"]).empty()
– Stranger
2 days ago
@Stranger, yes I tried but not work.
– vicky793
2 days ago
@misorude, $('#empty_search').on('click', function(){ $("#view_table[data-search]").empty() }); is right?
– vicky793
2 days ago
That would select thetable
element in your example (because it has that id, and has an attribute nameddata-search
) - but I doubt you actually want to “empty” the whole table(?). You are talking about a search field, but there is no such thing in the code you have shown above. If that field gets created dynamically by another script, then use your browser dev tools to inspect it and find out what id (or other characteristics suitable for selection, if necessary) it has. And to empty an input field, the right method would be setting the value to an empty string.
– misorude
2 days ago
|
show 5 more comments
this.["data-search"]
makes no sense to begin with. Apart from thatthis
probably isn’t what you expect it to be in that context, the syntax is bogus as well - it is eitherfoo.bar
orfoo[bar]
- but not dot and square brackets.
– misorude
2 days ago
try to use$( this ).data( "search", '' )
instead of$.(this.["data-search"]).empty()
– Stranger
2 days ago
@Stranger, yes I tried but not work.
– vicky793
2 days ago
@misorude, $('#empty_search').on('click', function(){ $("#view_table[data-search]").empty() }); is right?
– vicky793
2 days ago
That would select thetable
element in your example (because it has that id, and has an attribute nameddata-search
) - but I doubt you actually want to “empty” the whole table(?). You are talking about a search field, but there is no such thing in the code you have shown above. If that field gets created dynamically by another script, then use your browser dev tools to inspect it and find out what id (or other characteristics suitable for selection, if necessary) it has. And to empty an input field, the right method would be setting the value to an empty string.
– misorude
2 days ago
this.["data-search"]
makes no sense to begin with. Apart from that this
probably isn’t what you expect it to be in that context, the syntax is bogus as well - it is either foo.bar
or foo[bar]
- but not dot and square brackets.– misorude
2 days ago
this.["data-search"]
makes no sense to begin with. Apart from that this
probably isn’t what you expect it to be in that context, the syntax is bogus as well - it is either foo.bar
or foo[bar]
- but not dot and square brackets.– misorude
2 days ago
try to use
$( this ).data( "search", '' )
instead of $.(this.["data-search"]).empty()
– Stranger
2 days ago
try to use
$( this ).data( "search", '' )
instead of $.(this.["data-search"]).empty()
– Stranger
2 days ago
@Stranger, yes I tried but not work.
– vicky793
2 days ago
@Stranger, yes I tried but not work.
– vicky793
2 days ago
@misorude, $('#empty_search').on('click', function(){ $("#view_table[data-search]").empty() }); is right?
– vicky793
2 days ago
@misorude, $('#empty_search').on('click', function(){ $("#view_table[data-search]").empty() }); is right?
– vicky793
2 days ago
That would select the
table
element in your example (because it has that id, and has an attribute named data-search
) - but I doubt you actually want to “empty” the whole table(?). You are talking about a search field, but there is no such thing in the code you have shown above. If that field gets created dynamically by another script, then use your browser dev tools to inspect it and find out what id (or other characteristics suitable for selection, if necessary) it has. And to empty an input field, the right method would be setting the value to an empty string.– misorude
2 days ago
That would select the
table
element in your example (because it has that id, and has an attribute named data-search
) - but I doubt you actually want to “empty” the whole table(?). You are talking about a search field, but there is no such thing in the code you have shown above. If that field gets created dynamically by another script, then use your browser dev tools to inspect it and find out what id (or other characteristics suitable for selection, if necessary) it has. And to empty an input field, the right method would be setting the value to an empty string.– misorude
2 days ago
|
show 5 more comments
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Here is an example: http://jsfiddle.net/9ynp8j6k/1/
You can empty the form field like this:
$('#clear').on("click",function() {
$('.bootstrap-table .form-control').val("");
});
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Here is an example: http://jsfiddle.net/9ynp8j6k/1/
You can empty the form field like this:
$('#clear').on("click",function() {
$('.bootstrap-table .form-control').val("");
});
add a comment |
up vote
1
down vote
accepted
Here is an example: http://jsfiddle.net/9ynp8j6k/1/
You can empty the form field like this:
$('#clear').on("click",function() {
$('.bootstrap-table .form-control').val("");
});
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Here is an example: http://jsfiddle.net/9ynp8j6k/1/
You can empty the form field like this:
$('#clear').on("click",function() {
$('.bootstrap-table .form-control').val("");
});
Here is an example: http://jsfiddle.net/9ynp8j6k/1/
You can empty the form field like this:
$('#clear').on("click",function() {
$('.bootstrap-table .form-control').val("");
});
answered 2 days ago
de-facto
634
634
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53373565%2fhow-to-empty-search-box-on-click-event-in-wenzhixin-bootstrap-table-without-refr%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
this.["data-search"]
makes no sense to begin with. Apart from thatthis
probably isn’t what you expect it to be in that context, the syntax is bogus as well - it is eitherfoo.bar
orfoo[bar]
- but not dot and square brackets.– misorude
2 days ago
try to use
$( this ).data( "search", '' )
instead of$.(this.["data-search"]).empty()
– Stranger
2 days ago
@Stranger, yes I tried but not work.
– vicky793
2 days ago
@misorude, $('#empty_search').on('click', function(){ $("#view_table[data-search]").empty() }); is right?
– vicky793
2 days ago
That would select the
table
element in your example (because it has that id, and has an attribute nameddata-search
) - but I doubt you actually want to “empty” the whole table(?). You are talking about a search field, but there is no such thing in the code you have shown above. If that field gets created dynamically by another script, then use your browser dev tools to inspect it and find out what id (or other characteristics suitable for selection, if necessary) it has. And to empty an input field, the right method would be setting the value to an empty string.– misorude
2 days ago