I want to pass <li> id or value
in onclick
event. here is my exiting code.
<li onclick="getPaging(this.value)" id="1" value="1">1</li>
<li onclick="getPaging(this.value)" id="2" value="2">2</li>
here is the javascript code
function getPaging(str)
{
$("#loading-content").load("dataSearch.php?"+str, hideLoader);
}
Try like this...
<script>
function getPaging(str) {
$("#loading-content").load("dataSearch.php?"+str, hideLoader);
}
</script>
<li onclick="getPaging(this.id)" id="1">1</li>
<li onclick="getPaging(this.id)" id="2">2</li>
or unobtrusively
$(function() {
$("li").on("click",function() {
showLoader();
$("#loading-content").load("dataSearch.php?"+this.id, hideLoader);
});
});
using just
<li id="1">1</li>
<li id="2">2</li>